I was just screwing around in ghci, playing with the pattern:
> sum [1..1000] 500500 > sum [1..100] 5050 > sum [1..10] 55 > sum [1..1] 1
And it was unfortunate to see the pattern “break” at [1..1]. The pattern being, sum [1..10^n] = 5 followed by (n-1) zeros followed by 5 followed by (n-1) zeros.
But check this out:
5050 = (5 * 10^1) * 10^2 + (5 * 10^1) 55 = (5 * 10^0) * 10^1 + (5 * 10^0)
Continuing the pattern…
(5 * 10^-1) * 10^0 + (5 * 10^-1) = 0.5 * 1 + 0.5 = 1
So 1 is 5 followed by -1 zeros (itself zero digits, 1 for the 5 and -1 for the zeros, which is why we multiply by 10^0), followed by 5 followed by -1 zeros, and the pattern didn’t break. Woah…
Yeah, not mathematically deep, just kinda funny.
