OFFSET
0,2
COMMENTS
Equivalently, this is the number of nonnegative integers k such that (n^2) OR (k^2) = n^2 (where OR denotes the bitwise OR operator); this connects this sequence to A001316.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
a(2^k) = 2 for any k >= 0.
a(n) <= n+1.
EXAMPLE
For n = 7:
- we have:
k 7^2 AND k^2
- -----------
0 0 = 0
1 1 = 1
2 0 <> 4
3 1 <> 9
4 16 = 16
5 17 <> 25
6 32 <> 36
7 49 = 49
- hence a(7) = 4.
PROG
(PARI) a(n) = sum(k=0, n, bitand(n^2, k^2)==k^2)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 19 2020
STATUS
approved