A304024 a(n) is the largest integer with n digits in base 3/2.
2, 22, 212, 2122, 21222, 212212, 2122112, 21221112, 212211122, 2122111222, 21221112212, 212211122122, 2122111221212, 21221112212112, 212211122121122, 2122111221211222, 21221112212112212, 212211122121122122
Offset: 0
Examples
The number 5 in base 3/2 is 22, and the number 6 is 210. Therefore, 22 is the largest two-digit integer.
Crossrefs
Programs
-
PARI
first(n) = {my(res=vector(n), c = 2); res[1]=2; for(i=2, n, res[i] = 10 * res[i-1] + 2; if(c % 2 == 1, res[i] -= 10); c = 3 * c / 2 + if(c%2==0, 2, 1/2)); res} \\ David A. Corneth, May 11 2018
Formula
a(1) = 2, for n > 1, a(n) = 10 * a(n - 1) + 2 if A304025(n - 1) is even. Otherwise, a(n) = 10 * a(n - 1) - 8. - David A. Corneth, May 11 2018
Comments