login
Sum of digits of n written in fractional base 8/5.
18

%I #7 Mar 16 2020 16:03:14

%S 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,

%T 16,17,18,19,11,12,13,14,15,16,17,18,13,14,15,16,17,18,19,20,18,19,20,

%U 21,22,23,24,25,14,15,16,17,18,19,20,21,13,14,15,16,17

%N Sum of digits of n written in fractional base 8/5.

%C The base 8/5 expansion is unique and thus the sum of digits function is well-defined.

%F a(n) = A007953(A024647(n)).

%e In base 8/5 the number 20 is represented by 524 and so a(20) = 5 + 2 + 4 = 11.

%o (Sage)

%o def basepqsum(p, q, n):

%o L = [n]

%o i = 1

%o while L[i-1]>=p:

%o x=L[i-1]

%o L[i-1]=x.mod(p)

%o L.append(q*(x//p))

%o i+=1

%o return sum(L)

%o [basepqsum(8,5,i) for i in [0..100]]

%Y Cf. A024647, A007953, A000120, A053829, A244040.

%K nonn,base

%O 0,3

%A _Tom Edgar_, Jul 18 2014