A245355 Sum of digits of n written in fractional base 8/5.
0, 1, 2, 3, 4, 5, 6, 7, 5, 6, 7, 8, 9, 10, 11, 12, 7, 8, 9, 10, 11, 12, 13, 14, 12, 13, 14, 15, 16, 17, 18, 19, 11, 12, 13, 14, 15, 16, 17, 18, 13, 14, 15, 16, 17, 18, 19, 20, 18, 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19, 20, 21, 13, 14, 15, 16, 17
Offset: 0
Examples
In base 8/5 the number 20 is represented by 524 and so a(20) = 5 + 2 + 4 = 11.
Links
Programs
-
Mathematica
a[n_] := a[n] = If[n == 0, 0, a[5 * Floor[n/8]] + Mod[n, 8]]; Array[a, 100, 0] (* Amiram Eldar, Aug 02 2025 *)
-
PARI
a(n) = if(n == 0, 0, a(n\8 * 5) + n % 8); \\ Amiram Eldar, Aug 02 2025
-
Sage
def basepqsum(p, q, n): L = [n] i = 1 while L[i-1]>=p: x=L[i-1] L[i-1]=x.mod(p) L.append(q*(x//p)) i+=1 return sum(L) [basepqsum(8,5,i) for i in [0..100]]
Comments