News for hackers. Stuff that matters.
Re:6174 by shermantanktop on Tuesday January 16, 2024 @05:15PM (#39019906)
Right, the digit sum of 10 is 1...perhaps I should have said "final digit sum." Same for 10000, or 1 with any number of zeroes after it.

The point of this trickery is that N-1 added to any number is really adding N (which adds 1 to the second position, by definition) and adding -1 (which subtracts 1 from the first position).

In base 10, this is the adding 9 trick. It can be extended by using any multiple of 9. That applies to the N-1 version, so that adding M*(N-1) to a base N number yields the same digit sum.

1+9 = 10 = 1

1 + 27 = 28 = 10 = 1

In hex:

1 + F = 10 = 1

1 + 2D = 2E = 10 = 1

There are no comments on this comment yet.