cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A065361 Rebase n from 3 to 2. Replace 3^k with 2^k in ternary expansion of n.

This page as a plain text file.
%I A065361 #31 Jan 03 2021 14:36:26
%S A065361 0,1,2,2,3,4,4,5,6,4,5,6,6,7,8,8,9,10,8,9,10,10,11,12,12,13,14,8,9,10,
%T A065361 10,11,12,12,13,14,12,13,14,14,15,16,16,17,18,16,17,18,18,19,20,20,21,
%U A065361 22,16,17,18,18,19,20,20,21,22,20,21,22,22,23,24,24,25,26,24,25,26,26,27
%N A065361 Rebase n from 3 to 2. Replace 3^k with 2^k in ternary expansion of n.
%C A065361 Notation: (3)[n](2).
%C A065361 Fixed point of the morphism 0->0,1,2; 1->2,3,4; 2->4,5,6; ...; n->2n,2n+1,2n+2. - _Philippe Deléham_, Oct 22 2011
%H A065361 Harry J. Smith, <a href="/A065361/b065361.txt">Table of n, a(n) for n = 0..1000</a>
%F A065361 a(0)=0, a(3n)=2*a(n), a(3n+1)=2*a(n)+1, a(3n+2)=2*a(n)+2. - _Benoit Cloitre_, Dec 21 2002
%F A065361 a(n) = 2*a(floor(n/3))+n-3*floor(n/3). - _Benoit Cloitre_, Apr 27 2003
%F A065361 a(n) = Sum_{k>=0} A030341(n,k)*2^k. - _Philippe Deléham_, Oct 22 2011
%e A065361 15 = 120 -> 1(4)+2(2)+0(1) = 8 = a(15).
%t A065361 t = Table[FromDigits[RealDigits[n, 3], 2], {n, 0, 100}]
%t A065361 (* _Clark Kimberling_, Aug 02 2012 *)
%o A065361 (PARI) a(n)=if(n<1,0,if(n%3,a(n-1)+1,2*a(n/3)))
%o A065361 (PARI) a(n)=if(n<1,0,2*a(floor(n/3))+n-3*floor(n/3))
%o A065361 (PARI) Rebase(x, b, c)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=c); return(e) } { for (n=0, 1000, write("b065361.txt", n, " ", Rebase(n, 3, 2)) ) } \\ _Harry J. Smith_, Oct 17 2009
%o A065361 (Julia)
%o A065361 function a(n)
%o A065361     m, r, b = n, 0, 1
%o A065361     while m > 0
%o A065361         m, q = divrem(m, 3)
%o A065361         r += b * q
%o A065361         b *= 2
%o A065361     end
%o A065361 r end; [a(n) for n in 0:76] |> println # _Peter Luschny_, Jan 03 2021
%Y A065361 Cf. A065362, A030341.
%K A065361 base,easy,nonn
%O A065361 0,3
%A A065361 _Marc LeBrun_, Oct 31 2001