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!)
A178679 Numbers n such that the binary expansion of n starts with the base 3 expansion of n. 3

%I #14 Dec 01 2023 03:26:37

%S 0,1,9,10,12,94,118,120,2217,22204,22602,26608,27004,27009,531795,

%T 5021473,5321298,6384861,50218140,63858541,1181639052,12029699478,

%U 14392731189,15114438648,283004031766,283592574694,2672433464707,2835932927661

%N Numbers n such that the binary expansion of n starts with the base 3 expansion of n.

%C It is much easier to find the terms by backtracking (see PARI code). It seems that the sequence is infinite and log(a(n))/(n*log(3))->1 as n goes to infinity. - _Robert Gerbicz_, Jun 04 2010

%H Robert Gerbicz, <a href="/A178679/b178679.txt">Table of n, a(n) for n = 1..208</a>

%e 2217 = 100010101001 (base 2)

%e 2217 = 10001010.... (base 3)

%e 531795 = 10000001110101010011 (base 2)

%e 531795 = 1000000111010....... (base 3)

%e 50218140 = 10111111100100010010011100 (base 2) = 10111111100100010 (base 3)

%e 63858541 = 11110011100110011101101101 (base 2) = 11110011100110011 (base 3)

%t Do[i3=IntegerDigits[n,2];l3=Length[i3];i=FromDigits[i3,3]; i2=IntegerDigits[i,2];If[i3==Take[i2,l3],Print[i]];,{n,0,10^7}];(* _Ray Chandler_, Jun 03 2010 *)

%o (PARI)

%o ct=1;print("1 0");for(L=1,200,pos=1;a=vector(L);a[1]=0;\

%o while(pos>0,backtrack=0;a[pos]++;\

%o if(a[pos]>1,backtrack=1,\

%o n1=sum(i=1,pos,a[i]*3^(L-i));n2=n1+3^(L-pos);n=sum(i=1,L,a[i]*2^(L-i));\

%o if(pos==L,L1=length(binary(n1));\

%o if(shift(n1,L-L1)==n,ct++;print(ct" "n1)),\

%o b1=binary(n1);b2=binary(n2);L1=length(b1);L2=length(b2);ext=1;\

%o if(L1==L2,s=0;while(s+1<=L1&&s+1<=pos&&b1[s+1]==b2[s+1],s++);\

%o if(sum(i=1,s,abs(b1[i]-a[i]))!=0,ext=0));if(ext,pos++;a[pos]=-1)));\

%o if(backtrack,pos--)))

%o \\ _Robert Gerbicz_, Jun 04 2010

%Y Cf. A169828, A178680.

%K nonn

%O 1,3

%A _Zak Seidov_ and _Ray Chandler_, Jun 03 2010

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 April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)