|
|
A329653
|
|
Describe n in binary, convert to decimal: write in base 10 the binary number concat(c0,0,c1,1) where c0, c1 is the number of '0's and '1's in n, all written in binary.
|
|
1
|
|
|
9, 3, 11, 5, 19, 21, 21, 7, 27, 37, 37, 23, 37, 23, 23, 9, 35, 53, 53, 39, 53, 39, 39, 41, 53, 39, 39, 41, 39, 41, 41, 11, 43, 69, 69, 55, 69, 55, 55, 73, 69, 55, 55, 73, 55, 73, 73, 43, 69, 55, 55, 73, 55, 73, 73, 43, 55, 73, 73, 43, 73, 43, 43, 13, 51, 85, 85, 71, 85
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
LINKS
|
|
|
FORMULA
|
a(n+1) = a(n) if n == 1 (mod 4), n > 1.
|
|
EXAMPLE
|
In the binary expansion of n = 0, we have one '0', zero '1's => 1001[2] = 9[10] = a(0).
In the binary expansion of n = 1, we have zero '0's, one '1' => 0011 = 3[10] = a(1).
In the binary expansion of n = 2 = 10[2], we have one '0', one '1' => 1011[2] = 11[10] = a(2).
In the binary expansion of n = 3 = 11[2], we have zero '0's, two (= 10[2]) '1's => a(3) = 00101[2] = 5[10].
|
|
PROG
|
(PARI) apply( {d(a, b=2)=fromdigits(concat([binary(logint(a+!a, 2)+1-a=hammingweight(a)), 0, if(a, binary(a)), 1]), b)}, [0..99]) \\ 2n optional arg: base in which the string of bits is to be read - i.e., b=10: write it in binary, b=2: convert to decimal!
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|