Definition: The sum of a number's digits in base b, where the signs alternate, starting with positive for the least significant digit (d₀ - d₁ + d₂ - ...). It is used to test for divisibility by b+1.
Chapter 1: The Zig-Zag Score (Elementary School Understanding)
Let's take a regular number like 374. We can play a "Zig-Zag" game with its digits.
Start at zero.
Take the last digit, 4, and add it. (Score: 4)
Take the middle digit, 7, and subtract it. (Score: 4 - 7 = -3)
Take the first digit, 3, and add it. (Score: -3 + 3 = 0)
The final Zig-Zag Score is 0.
Here's the magic trick: In our everyday number system (base-10), if the Zig-Zag score is 0, the original number is perfectly divisible by 11!
Let's check: 374 ÷ 11 = 34. It works!
What about 584?
Zig-Zag Score: 4 - 8 + 5 = 1.
Let's check: 584 ÷ 11 = 53 with a remainder of 1.
The Zig-Zag Score isn't just a trick for 0; it secretly tells you the remainder you'll get when you divide by 11. The Alternating Sum of Digits is the official name for this Zig-Zag Score, and it works for any number system, not just ours.
Chapter 2: The Universal Divisibility Test (Middle School Understanding)
The Alternating Sum of Digits, A_b(N), is a powerful tool that gives us a divisibility test in any number system (or "base").
The Rule: A number N written in base b is divisible by b+1 if and only if its Alternating Sum of Digits A_b(N) is divisible by b+1. In fact, N and A_b(N) will always have the same remainder when divided by b+1.
In our base-10 system: b=10, so b+1=11. This is why the rule works for divisibility by 11.
For N = 1,353:
A₁₀(1353) = 3 - 5 + 3 - 1 = 0.
The rule says 1353 is divisible by 11. Check: 1353 / 11 = 123.
In a computer's base-8 (octal) system: b=8, so b+1=9. This gives us a trick to test for divisibility by 9.
Let's take the number 327 written in base-8. Its value is 3*8² + 2*8¹ + 7*8⁰ = 192 + 16 + 7 = 215 in decimal.
Let's find its alternating sum: A₈(327) = 7 - 2 + 3 = 8.
The rule says that 215 divided by 9 should have a remainder of 8.
Check: 215 ÷ 9 = 23 with a remainder of 8. The rule works perfectly!
This shows that the Alternating Sum is not just one trick, but a universal law that connects a number's digits to its divisibility properties in any base.
Chapter 3: The General Proof (High School Understanding)
The Alternating Sum of Digits provides a universal divisibility test for the number b+1 in any base b. The theorem states:
N ≡ A_b(N) (mod b+1)
Proof:
Base b Expansion: We write N in terms of its base b digits dᵢ:
N = d₀b⁰ + d₁b¹ + d₂b² + d₃b³ + ...
Modulo b+1 Analysis: We analyze this equation modulo b+1. The key is to understand the behavior of the base b itself. By the definition of congruence, any number is congruent to its remainder. The remainder of b divided by b+1 is -1 (since b = 1*(b+1) - 1).
b ≡ -1 (mod b+1)
Powers of the Base: Now we look at the powers of b:
b⁰ ≡ (-1)⁰ ≡ 1 (mod b+1)
b¹ ≡ (-1)¹ ≡ -1 (mod b+1)
b² ≡ (-1)² ≡ 1 (mod b+1)
In general: bⁱ ≡ (-1)ⁱ (mod b+1).
Substitution: We substitute this result into the expansion of N:
N ≡ d₀(1) + d₁(-1) + d₂(1) + d₃(-1) + ... (mod b+1)
Conclusion: This simplifies to N ≡ d₀ - d₁ + d₂ - d₃ + ... (mod b+1). The expression on the right is the definition of A_b(N). The theorem is proven.
The Alternating Bit Sum from the previous term is simply the specific case of this general law where b=2, which gives the divisibility test for b+1=3.
Chapter 4: A Consequence of Polynomial Evaluation (College Level)
The most elegant understanding of the Alternating Sum of Digits comes from viewing a number's representation as a polynomial.
An integer N with digits dₖ...d₁d₀ in base b can be expressed as a polynomial P(x) = dₖxᵏ + ... + d₁x + d₀ evaluated at x=b.
N = P(b)
The Alternating Sum of Digits, A_b(N) = d₀ - d₁ + d₂ - ..., is precisely this same polynomial evaluated at x = -1.
A_b(N) = P(-1)
The theorem N ≡ A_b(N) (mod b+1) is therefore a direct consequence of a fundamental property of polynomial rings. For any polynomial P(x) with integer coefficients, it is true that:
P(b) ≡ P(-1) (mod b+1)
Proof: This follows from the property that for any integers x, y, m, if x ≡ y (mod m), then P(x) ≡ P(y) (mod m). We know that b ≡ -1 (mod b+1), so we can substitute x=b, y=-1, and m=b+1 to get the result.
This reframes the divisibility rule as a deep truth about the structure of polynomials. The function φ(P(x)) = P(x) mod (x+1) is a homomorphism from the ring of polynomials ℤ[x] to the ring of integers ℤ. The Alternating Sum of Digits is the "shadow" that the number N casts in the modular world of its base plus one, and this shadow is perfectly captured by evaluating the number's polynomial form at -1.
Chapter 5: Worksheet - The Universal Rule
Part 1: The Zig-Zag Score (Elementary Level)
What is the Zig-Zag score for the number 528?
Based on your score, is 528 divisible by 11? Check with a calculator.
What is the Zig-Zag score for 913? What will the remainder be when you divide 913 by 11?
Part 2: Divisibility in Other Bases (Middle School Level)
You are working in base-6. The Alternating Sum of Digits will be a test for divisibility by what number?
The number 415 in base-6 (written 415₆) has the decimal value 4*36 + 1*6 + 5*1 = 155. Calculate A₆(415).
Use your result from question 2 to predict the remainder of 155 ÷ 7. Check your prediction.
Part 3: The General Proof (High School Level)
What is the value of 10⁵⁰ (mod 11)? Explain your reasoning using the b ≡ -1 (mod b+1) principle.
The standard sum of digits (d₀ + d₁ + d₂ + ...) is a divisibility test for b-1. Explain why, using a proof similar to the one for the alternating sum. What is the key difference in the modular behavior of b?
Part 4: Polynomials (College Level)
A number N is represented in base-7 as 2653₇.
Write the polynomial P(x) that represents this number.
What is the value of N? (Calculate P(7)).
What is A₇(N)? (Calculate P(-1)).
Show that P(7) ≡ P(-1) (mod 8).