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”).

A375486
a(n) is the number of integers k between 0 and n such that n OR k is a prime number (where OR denotes the bitwise OR operator).
3
0, 0, 3, 4, 2, 6, 3, 8, 2, 4, 3, 8, 3, 8, 0, 0, 5, 12, 7, 16, 7, 14, 11, 24, 6, 12, 6, 12, 14, 30, 15, 32, 7, 14, 6, 12, 9, 20, 4, 8, 13, 28, 17, 36, 11, 22, 15, 32, 9, 18, 6, 12, 13, 28, 0, 0, 14, 28, 15, 32, 15, 32, 0, 0, 13, 26, 15, 32, 13, 26, 19, 40, 14
OFFSET
0,3
EXAMPLE
The first terms, alongside the corresponding k's, are:
n a(n) k's
-- ---- ------------------------
0 0 None
1 0 None
2 3 0, 1, 2
3 4 0, 1, 2, 3
4 2 1, 3
5 6 0, 1, 2, 3, 4, 5
6 3 1, 3, 5
7 8 0, 1, 2, 3, 4, 5, 6, 7
8 2 3, 5
9 4 2, 3, 4, 5
10 3 1, 3, 9
11 8 0, 1, 2, 3, 8, 9, 10, 11
12 3 1, 5, 9
13 8 0, 1, 4, 5, 8, 9, 12, 13
14 0 None
15 0 None
PROG
(PARI) a(n) = sum(k = 0, n, isprime(bitor(n, k)))
CROSSREFS
Cf. A375485 (XOR variant), A375487 (AND variant).
Sequence in context: A154570 A145961 A369557 * A082928 A139524 A247413
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Aug 17 2024
STATUS
approved