login
A024638
n written in fractional base 6/5.
3
0, 1, 2, 3, 4, 5, 50, 51, 52, 53, 54, 55, 540, 541, 542, 543, 544, 545, 5430, 5431, 5432, 5433, 5434, 5435, 54320, 54321, 54322, 54323, 54324, 54325, 543210, 543211, 543212, 543213, 543214, 543215, 5432100, 5432101, 5432102, 5432103, 5432104, 5432105, 5432150
OFFSET
0,3
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
Cf. A024629.
Sequence in context: A278940 A273470 A303163 * A037330 A062939 A069881
KEYWORD
nonn,base
EXTENSIONS
Terms a(42) and beyond from Andrew Howroyd, Aug 19 2019
STATUS
approved