[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A351886
a(n) is the number of k < n such that a(k) AND n = 0 (where AND denotes the bitwise AND operator).
3
0, 1, 2, 1, 4, 2, 3, 1, 8, 4, 6, 3, 8, 3, 4, 1, 16, 9, 11, 6, 14, 5, 8, 4, 17, 9, 10, 5, 10, 3, 5, 1, 32, 16, 21, 10, 24, 12, 15, 7, 26, 11, 17, 7, 16, 6, 11, 4, 39, 19, 20, 10, 24, 10, 11, 4, 26, 12, 15, 7, 12, 3, 6, 1, 64, 34, 34, 20, 41, 21, 21, 10, 45, 21
OFFSET
0,3
COMMENTS
The definition is recursive: a(n) depends on prior terms (a(0), ..., a(n-1)); a(0) = 0 corresponds to an empty sum.
LINKS
FORMULA
a(2^k) = 2^k.
EXAMPLE
The first terms, alongside the corresponding k's, are:
n a(n) k's
-- ---- -------------------------
0 0 {}
1 1 {0}
2 2 {0, 1}
3 1 {0}
4 4 {0, 1, 2, 3}
5 2 {0, 2}
6 3 {0, 1, 3}
7 1 {0}
8 8 {0, 1, 2, 3, 4, 5, 6, 7}
9 4 {0, 2, 4, 5}
10 6 {0, 1, 3, 4, 7, 9}
11 3 {0, 4, 9}
12 8 {0, 1, 2, 3, 5, 6, 7, 11}
MAPLE
a:= proc(n) option remember; add(
`if`(Bits[And](n, a(j))=0, 1, 0), j=0..n-1)
end:
seq(a(n), n=0..80); # Alois P. Heinz, Feb 28 2022
PROG
(PARI) for (n=1, #a=vector(75), print1 (a[n]=sum(k=1, n-1, bitand(a[k], n-1)==0)", "))
(Python)
a = []
[a.append(sum(a[k] & n == 0 for k in range(n))) for n in range(74)]
print(a) # Michael S. Branicky, Feb 24 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 23 2022
STATUS
approved