A109827 Numbers written in an alternating binary-then-ternary base.
0, 1, 10, 11, 20, 21, 100, 101, 110, 111, 120, 121, 1000, 1001, 1010, 1011, 1020, 1021, 1100, 1101, 1110, 1111, 1120, 1121, 2000, 2001, 2010, 2011, 2020, 2021, 2100, 2101, 2110, 2111, 2120, 2121, 10000, 10001, 10010, 10011, 10020, 10021, 10100, 10101
Offset: 0
Examples
a(29) = 2021 as 29 = 2*12 + 0*6 + 2*2 + 1*1.
References
- Calvin T. Long, Elementary Introduction to Number Theory, 2nd ed., D.C. Heath and Company, 1972, p. 30.
Links
- Rick L. Shepherd, Table of n, a(n) for n = 0..9999
Crossrefs
Programs
-
PARI
my(table=[0,1,10,11,20,21]); a(n) = fromdigits(apply(d->table[d+1], digits(n,6)), 100); \\ Kevin Ryde, Aug 03 2021
-
PARI
A010693(n) = if(n%2, 2, 3) \\ Function m is A010693 with index 1 here. {\\ The function b(n, m) works for all nonnegative n and every sequence m of (mixed or constant) radices as described above. my(c, d, k, ntmp, p, v, x); b(n, m) = if(n < 0, , v = [1]; k = 0; while(1, k++; p = v[#v]*m(k); if(p <= n, v = concat(v, p), break)); ntmp = n; c = []; forstep(i = #v, 1, -1, d = ntmp\v[i]; c = concat(c, d); ntmp = ntmp - d*v[i]); x = 10; if(vecmax(c) < x, eval(Pol(c, 'x)), c)) \\ returned value is a vector of decimal coefficients if any calculated \\ digit is larger than 9 (i.e., not suitable as an OEIS term) } a(n) = b(n, A010693) \\ Rick L. Shepherd, Aug 04 2021
-
Python
a109827 = lambda n: 100 * a109827(n // 6) + 10 * ((n % 6) // 2) + n % 2 if n else 0 # David Radcliffe, Aug 03 2021
Comments