A072401 1 iff n is of the form 4^m*(8k+7).
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, 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, 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
Offset: 0
Links
- Jean-Paul Allouche and Jeffrey Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197; preprint. See Example 20.
- Eric Weisstein's World of Mathematics, Square Numbers.
- Index entries for sequences related to sums of squares.
- Index entries for characteristic functions.
Programs
-
Mathematica
A072400[n_] := Mod[If[Mod[n, 4] == 0, n/4^IntegerExponent[n, 4], n], 8]; a[n_] := 1 - Sign[7 - A072400[n]]; Table[a[n], {n, 0, 96}] (* Jean-François Alcover, Dec 13 2021 *)
-
PARI
a(n) = if(n, (n >> (2*valuation(n, 4))) % 8 == 7, 0); \\ Amiram Eldar, May 15 2025
-
Python
def A072401(n): return ((m:=(~n&n-1).bit_length())&1^1)&int((n>>m)&7==7) # Chai Wah Wu, Aug 01 2023
Comments