login
The binary expansion of a(n) contains the runs of consecutive 1's that appear both in the binary expansions of n and n+1.
2

%I #10 Apr 01 2022 09:03:32

%S 0,0,0,0,4,0,0,0,8,8,8,0,12,0,0,0,16,16,16,16,20,16,16,0,24,24,24,0,

%T 28,0,0,0,32,32,32,32,36,32,32,32,40,40,40,32,44,32,32,0,48,48,48,48,

%U 52,48,48,0,56,56,56,0,60,0,0,0,64,64,64,64,68,64,64,64

%N The binary expansion of a(n) contains the runs of consecutive 1's that appear both in the binary expansions of n and n+1.

%C We only consider runs of consecutive 1's that completely match in binary expansions of n and n+1, not simply single common 1's.

%H Rémy Sigrist, <a href="/A352729/b352729.txt">Table of n, a(n) for n = 0..8192</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = A352727(n, n+1).

%e For n = 42:

%e - the binary expansion of 42 is "101010",

%e - the binary expansion of 43 is "101011",

%e - the first two runs of 1's are the same, the others differ,

%e - so the binary expansion of a(42) is "101000",

%e - and a(42) = 40.

%o (PARI) A352724(n) = { my (r=[], o=0); while (n, my (v=valuation(n+n%2, 2)); if (n%2, r=concat(r, (2^v-1)*2^o)); o+=v; n\=2^v); r }

%o a(n) = vecsum(setintersect(A352724(n), A352724(n+1)))

%Y Cf. A129760, A352727.

%K nonn,base

%O 0,5

%A _Rémy Sigrist_, Mar 30 2022