OFFSET
0,3
COMMENTS
Leading zeros in the binary expansion of n are ignored.
The value a(0) = 1 corresponds to the empty concatenation.
See A301453 for similar sequences.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
FORMULA
a(2^n - 1) = 1 for any n >= 0.
a(2^n) = 2^n for any n >= 0.
a(2*n) = 2*a(n) for any n > 0.
EXAMPLE
For n = 9: the binary expansion of 9, "1001", can be split in 7 ways into nonempty substrings with Hamming weight at most 1:
- (100)(1),
- (10)(01),
- (10)(0)(1),
- (1)(001),
- (1)(00)(1),
- (1)(0)(01),
- (1)(0)(0)(1).
Hence a(9) = 7.
PROG
(PARI) a(n) = if (n==0, return (1), my (v=0, h=0); while (n, h += n%2; n\=2; if (h>1, break, v+=a(n))); return (v))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 08 2018
STATUS
approved