[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A109827 Numbers written in an alternating binary-then-ternary base. 5

%I #19 Aug 05 2021 00:13:37

%S 0,1,10,11,20,21,100,101,110,111,120,121,1000,1001,1010,1011,1020,

%T 1021,1100,1101,1110,1111,1120,1121,2000,2001,2010,2011,2020,2021,

%U 2100,2101,2110,2111,2120,2121,10000,10001,10010,10011,10020,10021,10100,10101

%N Numbers written in an alternating binary-then-ternary base.

%C Exercise 14 on page 30 of the Long textbook is "Let m_1, m_2, m_3 ... be an infinite sequence of integers such that m_i >= 2 for all i. Let M_0 = 1 and M_i = Product_{j=1..i} m_j for all i >= 1. Show that every nonnegative integer r can be written uniquely in the form r = c_n M_n + c_(n-1) M_(n-1) + ... + c_1 M_1 + c_0 where c_n <> 0 for r <> 0 and 0 <= c_i < m_(i+1) for all i." The current sequence of terms a(r) = (c_n c_(n-1) ... c_1 c_0 concatenated) is one example of an infinite family of hybrid representations (just using only 2 and 3). For the m_i, this sequence uses A010693. Then the corresponding M_i are A026549. Thus the places reading from right have values (1,2,2*3,2*3*2,2*3*2*3,...) = A026549. The (ternary) digit 2 may only appear in the even positions counting from the rightmost as position 1. Appending "00" to any term multiplies the number by 6.

%C However, appending a single "0" to a term multiplies the number by 2 or by 3 or produces an invalid string of digits -- or even none of the above (110 => 1100, 8 becomes 18) -- depending upon the original number and its length.

%D Calvin T. Long, Elementary Introduction to Number Theory, 2nd ed., D.C. Heath and Company, 1972, p. 30.

%H Rick L. Shepherd, <a href="/A109827/b109827.txt">Table of n, a(n) for n = 0..9999</a>

%e a(29) = 2021 as 29 = 2*12 + 0*6 + 2*2 + 1*1.

%o (Python) a109827 = lambda n: 100 * a109827(n // 6) + 10 * ((n % 6) // 2) + n % 2 if n else 0 # _David Radcliffe_, Aug 03 2021

%o (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

%o (PARI) A010693(n) = if(n%2, 2, 3) \\ Function m is A010693 with index 1 here.

%o {\\ The function b(n, m) works for all nonnegative n and every sequence m of (mixed or constant) radices as described above.

%o my(c, d, k, ntmp, p, v, x); b(n, m) = if(n < 0, , v = [1]; k = 0;

%o while(1, k++; p = v[#v]*m(k); if(p <= n, v = concat(v, p), break));

%o ntmp = n; c = [];

%o forstep(i = #v, 1, -1, d = ntmp\v[i]; c = concat(c, d); ntmp = ntmp - d*v[i]);

%o x = 10; if(vecmax(c) < x, eval(Pol(c, 'x)), c))

%o \\ returned value is a vector of decimal coefficients if any calculated

%o \\ digit is larger than 9 (i.e., not suitable as an OEIS term)

%o }

%o a(n) = b(n, A010693) \\ _Rick L. Shepherd_, Aug 04 2021

%Y Cf. A010693 (2, 3, 2, 3, ...), A026549 (1, 2, 6, 12, 36, ...), A007623 (numbers in factorial base), A049345 (numbers in primorial base), A007088 (numbers in base 2: binary), A007089 (numbers in base 3: ternary), A089293 (sum of digits).

%K base,easy,nonn

%O 0,3

%A _Rick L. Shepherd_, Jul 03 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 03:06 EDT 2024. Contains 375510 sequences. (Running on oeis4.)