Alternating digit sum 2026-11-05
The alternating digit sum of a nonnegative integer in radix iswith a positive sign on the units digit. Starting the signs from the opposite end can change the overall sign, so the convention should be stated.
Because , the positional expansion gives . This proves a divisibility test: divides the number exactly when it divides its alternating digit sum. In decimal notation, has alternating sum and equals .
The rule differs from the ordinary digit sum test modulo , which instead uses . Both follow from the same modular arithmetic principle of replacing the radix by its residue before evaluating the digit polynomial.
Balanced number Created 2026-10-20 Updated 2026-11-05
A balanced number is a positive integer whose first decimal digits have the same digit sum as its last decimal digits, where is the number of numerical digits. For odd , the middle numerical digit appears on both sides and cancels, so only the equally long outer halves need to be compared.
For example, is balanced because . It is not a palindromic number: equality of two digit sums does not require reversed digits. At odd length, is balanced because the outer pairs and both sum to three; its middle digit is irrelevant to the equality.
Digit dynamic programming can tabulate counts and value sums of fixed-length halves indexed by digit sum, then match equal indices. The first half must begin with a nonzero numerical digit, while the last half may contain initial zeros, as in . Preserving the half length is essential when assembling the positional value.
Digital root Created 2026-10-20 Updated 2026-11-05
The digital root of a nonnegative integer in integer radix is the single numerical digit obtained by repeatedly taking its digit sum. For example, in decimal representation, , while .
The process terminates: if , some nonzero digit occupies a position above the units, so . The positive integers therefore decrease until a single numerical digit remains. Each step preserves the integer congruence class modulo .
For positive inputs, every digit sum stays positive. The final digit lies in , rather than . Choosing the representative in this range giveswith . This explains why a positive multiple of has decimal digital root , not zero. The formula combines modular arithmetic with the positivity of the terminating representative.
Digit sum Created 2026-10-20 Updated 2026-11-05
The digit sum of a nonnegative integer in a specified radix is the sum of its numerical digits. Ifwrite , with . For example, . In binary representation, the digit sum is the Hamming weight of the digit string.
Since , the positional expansion givesIn decimal representation, this yields the familiar divisibility tests by and : the integer and its digit sum have the same remainder modulo either. For , both and leave remainder modulo . The argument explains the rule from modular arithmetic, rather than relying on a pattern noticed in examples.
Pandigital prime Created 2026-10-20 Updated 2026-11-05
A pandigital prime is a prime number that is also a pandigital number for a specified radix, digit alphabet and repetition convention. For example, uses each of exactly once and is prime; trial division by prime numbers at most its square root verifies the latter condition.
The digit sum supplies a useful obstruction. A decimal number using exactly once has digit sum . If this sum is divisible by and the number exceeds , the number is composite. In particular, a number using all ten decimal digits exactly once has digit sum and cannot be prime. The filter follows from the digit sum integer congruence, independently of the order in which the digits occur.
Pad every integer from through with leading zeros to obtain a unique six-digit decimal string. If its digits sum to , each digit is automatically at most , so the usual digit upper bound adds no restriction. We therefore count the nonnegative integer solutions ofBy stars and bars, there are . The all-zero string is not counted because its digit sum is zero, so every counted integer is positive. Thus the answer is .