login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A178679
Numbers n such that the binary expansion of n starts with the base 3 expansion of n.
3
0, 1, 9, 10, 12, 94, 118, 120, 2217, 22204, 22602, 26608, 27004, 27009, 531795, 5021473, 5321298, 6384861, 50218140, 63858541, 1181639052, 12029699478, 14392731189, 15114438648, 283004031766, 283592574694, 2672433464707, 2835932927661
OFFSET
1,3
COMMENTS
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
LINKS
EXAMPLE
2217 = 100010101001 (base 2)
2217 = 10001010.... (base 3)
531795 = 10000001110101010011 (base 2)
531795 = 1000000111010....... (base 3)
50218140 = 10111111100100010010011100 (base 2) = 10111111100100010 (base 3)
63858541 = 11110011100110011101101101 (base 2) = 11110011100110011 (base 3)
MATHEMATICA
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 *)
PROG
(PARI)
ct=1; print("1 0"); for(L=1, 200, pos=1; a=vector(L); a[1]=0; \
while(pos>0, backtrack=0; a[pos]++; \
if(a[pos]>1, backtrack=1, \
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)); \
if(pos==L, L1=length(binary(n1)); \
if(shift(n1, L-L1)==n, ct++; print(ct" "n1)), \
b1=binary(n1); b2=binary(n2); L1=length(b1); L2=length(b2); ext=1; \
if(L1==L2, s=0; while(s+1<=L1&&s+1<=pos&&b1[s+1]==b2[s+1], s++); \
if(sum(i=1, s, abs(b1[i]-a[i]))!=0, ext=0)); if(ext, pos++; a[pos]=-1))); \
if(backtrack, pos--)))
\\ Robert Gerbicz, Jun 04 2010
CROSSREFS
Sequence in context: A279731 A037408 A178680 * A154766 A116594 A249723
KEYWORD
nonn
AUTHOR
Zak Seidov and Ray Chandler, Jun 03 2010
STATUS
approved