|
|
A037834
|
|
a(n) = Sum_{i=1..m} |d(i) - d(i-1)|, where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.
|
|
21
|
|
|
0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 3, 2, 1, 2, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 3, 2, 3, 4, 5, 4, 5, 6, 5, 4, 3, 4, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
COMMENTS
|
Number of i such that |d(i) - d(i-1)| = 1, where Sum_{i=0..m} d(i)*2^i is the base-2 representation of n.
|
|
LINKS
|
|
|
MAPLE
|
local dgs ;
dgs := convert(n, base, 2);
add( abs(op(i, dgs)-op(i-1, dgs)), i=2..nops(dgs)) ;
|
|
MATHEMATICA
|
Table[Total@ Flatten@ Map[Abs@ Differences@ # &, Partition[ IntegerDigits[n, 2], 2, 1]], {n, 90}] (* Michael De Vlieger, May 09 2017 *)
|
|
PROG
|
(Haskell)
a037834 n = sum $ map fromEnum $ zipWith (/=) (tail bs) bs
where bs = a030308_row n
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|