login
a(n) is the number of nonnegative integers k such that (n^2) AND (k^2) = k^2 (where AND denotes the bitwise AND operator).
2

%I #12 Jan 20 2020 12:46:51

%S 1,2,2,3,2,5,3,4,2,5,5,9,3,4,4,4,2,4,5,7,5,12,9,4,3,9,4,11,4,7,4,6,2,

%T 5,4,7,5,12,7,15,5,7,12,13,9,17,4,3,3,7,9,4,4,20,11,15,4,8,7,12,4,5,6,

%U 6,2,4,5,7,4,11,7,14,5,12,12,29,7,8,15,5,5

%N a(n) is the number of nonnegative integers k such that (n^2) AND (k^2) = k^2 (where AND denotes the bitwise AND operator).

%C 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.

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

%H Rémy Sigrist, <a href="/A331532/a331532.png">Scatterplot of (x, y) such that (x^2) AND (y^2) = y^2, with 0 <= x <= 1024</a>

%F a(2^k) = 2 for any k >= 0.

%F a(n) <= n+1.

%e For n = 7:

%e - we have:

%e k 7^2 AND k^2

%e - -----------

%e 0 0 = 0

%e 1 1 = 1

%e 2 0 <> 4

%e 3 1 <> 9

%e 4 16 = 16

%e 5 17 <> 25

%e 6 32 <> 36

%e 7 49 = 49

%e - hence a(7) = 4.

%o (PARI) a(n) = sum(k=0, n, bitand(n^2, k^2)==k^2)

%Y Cf. A001316, A331533 (corresponding k's).

%K nonn,base

%O 0,2

%A _Rémy Sigrist_, Jan 19 2020