|
|
A179888
|
|
Starting with a(1)=2: if m is a term then also 4*m+1 and 4*m+2.
|
|
9
|
|
|
2, 9, 10, 37, 38, 41, 42, 149, 150, 153, 154, 165, 166, 169, 170, 597, 598, 601, 602, 613, 614, 617, 618, 661, 662, 665, 666, 677, 678, 681, 682, 2389, 2390, 2393, 2394, 2405, 2406, 2409, 2410, 2453, 2454, 2457, 2458, 2469, 2470, 2473, 2474, 2645, 2646, 2649
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
0 -> 01 and 1 -> 10 in binary representation of n;
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 4*a(floor(n/2)) + n mod 2 + 1 for n>1;
a(n) = SUM((bit(k)+1)*4^k: 0<=k<=L), where bit() and L such that n=SUM(bit(k)*2^k: 0<=k<=L).
|
|
EXAMPLE
|
__ n | __ bin(n) || ___ bin(a(n)) | base-4(a(n)) | __ a(n)
-----|-----------||---------------|--------------|---------
.. 1 | ....... 1 || .......... 10 | .......... 2 | ..... 2;
.. 2 | ...... 10 || ........ 1001 | ......... 21 | ..... 9;
.. 3 | ...... 11 || ........ 1010 | ......... 22 | .... 10;
.. 4 | ..... 100 || ...... 100101 | ........ 211 | .... 37;
.. 5 | ..... 101 || ...... 100110 | ........ 212 | .... 38;
.. 6 | ..... 110 || ...... 101001 | ........ 221 | .... 41;
.. 7 | ..... 111 || ...... 101010 | ........ 222 | .... 42;
.. 8 | .... 1000 || .... 10010101 | ....... 2111 | ... 149;
.. 9 | .... 1001 || .... 10010110 | ....... 2112 | ... 150;
. 10 | .... 1010 || .... 10011001 | ....... 2121 | ... 153;
. 11 | .... 1011 || .... 10011010 | ....... 2122 | ... 154;
. 12 | .... 1100 || .... 10100101 | ....... 2211 | ... 165;
. 13 | .... 1101 || .... 10100110 | ....... 2212 | ... 166;
. 14 | .... 1110 || .... 10101001 | ....... 2221 | ... 169;
. 15 | .... 1111 || .... 10101010 | ....... 2222 | ... 170;
. 16 | ... 10000 || .. 1001010101 | ...... 21111 | ... 597;
. 17 | ... 10001 || .. 1001010110 | ...... 21112 | ... 598;
. 18 | ... 10010 || .. 1001011001 | ...... 21121 | ... 601;
. 19 | ... 10011 || .. 1001011010 | ...... 21122 | ... 602;
. 20 | ... 10100 || .. 1001100101 | ...... 21211 | ... 613.
|
|
MAPLE
|
a:= n-> 1+(n mod 2)+`if`(n<2, 0, 4*a(iquo(n, 2))):
|
|
MATHEMATICA
|
Union@ Flatten@ NestList[ {4 # + 1, 4 # + 2} &, 2, 5] (* Robert G. Wilson v, Aug 16 2011 *)
|
|
PROG
|
(Haskell)
a179888 n = a179888_list !! (n-1)
a179888_list = 2 : f a179888_list where
f (x:xs) = x' : x'' : f (xs ++ [x', x'']) where x' = 4*x+1; x'' = x' + 1
(Python)
def A179888(n): return ((1<<(n.bit_length()<<1))-1)//3+int(bin(n)[2:], 4) # Chai Wah Wu, Jul 16 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,changed
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|