OFFSET
0,3
LINKS
FORMULA
To represent a number in base b, if a digit exceeds b, subtract b and carry 1. In fractional base a/b, subtract a and carry b.
MAPLE
a:= proc(n) `if`(n<1, 0, irem(n, 6, 'q')+a(5*q)*10) end:
seq(a(n), n=0..45); # Alois P. Heinz, Aug 19 2019
MATHEMATICA
a[n_]:= If[n==0, 0, 10*a[5*Floor[n/6]] + Mod[n, 6]]; Table[a[n], {n, 0, 50}] (* G. C. Greubel, Aug 19 2019 *)
PROG
(Sage)
def basepqExpansion(p, q, n):
L, i = [n], 1
while L[i-1] >= p:
x = L[i-1]
L[i-1] = x.mod(p)
L.append(q*floor(x/p))
i += 1
L.reverse()
return Integer(''.join(map(str, L)))
[basepqExpansion(6, 5, i) for i in [0..50]] # Tom Edgar, Hailey R. Olafson, and James Van Alstine, Jul 18 2014; modified and corrected by Peter Luschny, Aug 19 2019
(PARI) a(n) = {if(n<1, 0, a(n\6 * 5) * 10 + n%6)}; \\ Andrew Howroyd, Aug 19 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Terms a(42) and beyond from Andrew Howroyd, Aug 19 2019
STATUS
approved