A245345 Sum of digits of n written in fractional base 9/2.
0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 6, 7, 8, 9, 10, 11, 12, 13, 14, 8, 9, 10, 11, 12, 13, 14, 15, 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14, 15, 9, 10, 11, 12
Offset: 0
Examples
In base 9/2 the number 19 is represented by 41 and so a(19) = 4 + 1 = 5.
Links
Programs
-
Mathematica
a[n_] := a[n] = If[n == 0, 0, a[2 * Floor[n/9]] + Mod[n, 9]]; Array[a, 100, 0] (* Amiram Eldar, Aug 02 2025 *)
-
PARI
a(n) = if(n == 0, 0, a(n\9 * 2) + n % 9); \\ Amiram Eldar, Aug 02 2025
-
Sage
# uses [basepqsum from A245355] [basepqsum(9,2,i) for i in [0..100]]
Comments