OFFSET
0,3
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
FORMULA
For n = Sum_{i=0..m}c_i*(3/2)^i with each c_i in {0,1,2}, a(n) = Sum_{i=0..m}c_i*3^i.
From Rémy Sigrist, Apr 06 2021: (Start)
Apparently:
- a(3*n+1) = a(3*n) + 1 for any n >= 0,
- a(3*n+2) = a(3*n+1) + 1 for any n >= 0,
(End)
EXAMPLE
The base 3/2 representation of 7 is (2,1,1); i.e., 7 = 2*(3/2)^2 + 1*(3/2) + 1. Since 2*(3^2) + 1*3 + 1*1 = 22, we have a(7) = 22.
PROG
(Sage)
def changebase(n):
L=[n]
i=1
while L[i-1]>2:
x=L[i-1]
L[i-1]=x.mod(3)
L.append(2*floor(x/3))
i+=1
return sum([L[i]*3^i for i in [0..len(L)-1]])
[changebase(n) for n in [0..100]]
(PARI) a(n) = { my (v=0, t=1); while (n, v+=t*(n%3); n=(n\3)*2; t*=3); v } \\ Rémy Sigrist, Apr 06 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tom Edgar, Aug 28 2015
STATUS
approved