A179888 Starting with a(1)=2: if m is a term then also 4*m+1 and 4*m+2.
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
Offset: 1
Keywords
Examples
__ 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.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Quaternary
- Index entries for sequences related to binary expansion of n
Programs
-
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 -- Reinhard Zumkeller, Oct 29 2011
-
Maple
a:= n-> 1+(n mod 2)+`if`(n<2, 0, 4*a(iquo(n, 2))): seq(a(n), n=1..50); # Alois P. Heinz, Jul 15 2024
-
Mathematica
Union@ Flatten@ NestList[ {4 # + 1, 4 # + 2} &, 2, 5] (* Robert G. Wilson v, Aug 16 2011 *)
-
Python
def A179888(n): return ((1<<(n.bit_length()<<1))-1)//3+int(bin(n)[2:],4) # Chai Wah Wu, Jul 16 2024
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).
Comments