login
1 iff n is of the form 4^m*(8k+7).
11

%I #28 Aug 30 2023 20:40:48

%S 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,

%T 0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,

%U 0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0

%N 1 iff n is of the form 4^m*(8k+7).

%C Characteristic function of A004215, indicating numbers not the sum of 3 integer squares.

%C a(n) + 1 is the smallest positive number such that (a(n) + 1) * n is the sum of three squares. - _Peter Schorn_, Jul 18 2023

%H J.-P. Allouche and J. Shallit, <a href="https://doi.org/10.1016/0304-3975(92)90001-V">The ring of k-regular sequences</a>, Theoretical Computer Sci., 98 (1992), 163-197; <a href="http://www.cs.uwaterloo.ca/~shallit/Papers/as0.ps">preprint</a>. See Example 20.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SquareNumber.html">Square Numbers.</a>

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares.</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(n) = 1 - A057427(7 - A072400(n)).

%F a(A004215(k)) = 1 for k>0.

%F a(n) = A057427(A064873(n)).

%F For n<112: a(n)=A064873(n), but A064873(112)=2, as also a(112 - 1) = 1.

%t A072400[n_] := Mod[If[Mod[n, 4] == 0, n/4^IntegerExponent[n, 4], n], 8];

%t a[n_] := 1 - Sign[7 - A072400[n]];

%t Table[a[n], {n, 0, 96}] (* _Jean-François Alcover_, Dec 13 2021 *)

%o (Python)

%o def A072401(n): return ((m:=(~n&n-1).bit_length())&1^1)&int((n>>m)&7==7) # _Chai Wah Wu_, Aug 01 2023

%Y Cf. A004215, A057427, A064873, A072400.

%Y Cf. A071374.

%K nonn

%O 0,1

%A _Reinhard Zumkeller_, Jun 16 2002