[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
Search: a001481 -id:a001481
Displaying 21-30 of 231 results found. page 1 2 3 4 5 6 7 8 9 10 ... 24
     Sort: relevance | references | number | modified | created      Format: long | short | data
A229140 Smallest k such that k^2 + l^2 = n-th number expressible as sum of two squares (A001481). +20
0
0, 0, 1, 0, 1, 2, 0, 1, 2, 0, 1, 3, 2, 0, 1, 2, 4, 3, 0, 1, 2, 4, 3, 0, 1, 4, 2, 3, 5, 0, 1, 2, 6, 3, 5, 4, 0, 1, 2, 5, 3, 4, 7, 0, 1, 2, 5, 3, 7, 4, 6, 0, 1, 2, 8, 3, 6, 4, 0, 1, 5, 2, 7, 3, 6, 4, 9, 8, 0, 1, 2, 3, 6, 9, 4, 7, 5, 0, 1, 2, 9, 3, 8, 4, 7, 5, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
a(n) = 0 if A001481(n) is square. Conjecture: the values between two zeros are always distinct from each other.
LINKS
EXAMPLE
The 6th number expressible as sum of two squares A001481(6) = 8 = 2^2 + 2^2, so a(6)=2.
PROG
(PARI) for(n=1, 300, s=sqrtint(n); forstep(i=s, 1, -1, if(issquare(n-i*i), print1(sqrtint(n-i*i), ", "); break)))
KEYWORD
nonn
AUTHOR
Ralf Stephan, Sep 15 2013
STATUS
approved
A002144 Pythagorean primes: primes of the form 4*k + 1.
(Formerly M3823 N1566)
+10
482
5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 509, 521, 541, 557, 569, 577, 593, 601, 613, 617 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Rational primes that decompose in the field Q(sqrt(-1)). - N. J. A. Sloane, Dec 25 2017
These are the prime terms of A009003.
-1 is a quadratic residue mod a prime p if and only if p is in this sequence.
Sin(a(n)*Pi/2) = 1 with Pi = 3.1415..., see A070750. - Reinhard Zumkeller, May 04 2002
If at least one of the odd primes p, q belongs to the sequence, then either both or neither of the congruences x^2 = p (mod q), x^2 = q (mod p) are solvable, according to Gauss reciprocity law. - Lekraj Beedassy, Jul 17 2003
Odd primes such that binomial(p-1, (p-1)/2) == 1 (mod p). - Benoit Cloitre, Feb 07 2004
Primes that are the hypotenuse of a right triangle with integer sides. The Pythagorean triple is {A002365(n), A002366(n), a(n)}.
Also, primes of the form a^k + b^k, k > 1. - Amarnath Murthy, Nov 17 2003
The square of a(n) is the average of two other squares. This fact gives rise to a class of monic polynomials x^2 + bx + c with b = a(n) that will factor over the integers regardless of the sign of c. See A114200. - Owen Mertens (owenmertens(AT)missouristate.edu), Nov 16 2005
Also such primes p that the last digit is always 1 for the Nexus numbers of form n^p - (n-1)^p. - Alexander Adamchuk, Aug 10 2006
The set of Pythagorean primes is a proper subset of the set of positive fundamental discriminants (A003658). - Paul Muljadi, Mar 28 2008
A079260(a(n)) = 1; complement of A137409. - Reinhard Zumkeller, Oct 11 2008
From Artur Jasinski, Dec 10 2008: (Start)
If we take 4 numbers: 1, A002314(n), A152676(n), A152680(n) then multiplication table modulo a(n) is isomorphic to the Latin square:
1 2 3 4
2 4 1 3
3 1 4 2
4 3 2 1
and isomorphic to the multiplication table of {1, i, -i, -1} where i is sqrt(-1), A152680(n) is isomorphic to -1, A002314(n) with i or -i and A152676(n) vice versa -i or i. 1, A002314(n), A152676(n), A152680(n) are subfield of Galois field [a(n)]. (End)
Primes p such that the arithmetic mean of divisors of p^3 is an integer. There are 2 sequences of such primes: this one and A002145. - Ctibor O. Zizka, Oct 20 2009
Equivalently, the primes p for which the smallest extension of F_p containing the square roots of unity (necessarily F_p) contains the 4th roots of unity. In this respect, the n = 2 case of a family of sequences: see n=3 (A129805) and n=5 (A172469). - Katherine E. Stange, Feb 03 2010
Subsequence of A007969. - Reinhard Zumkeller, Jun 18 2011
A151763(a(n)) = 1.
k^k - 1 is divisible by 4*k + 1 if 4*k + 1 is a prime (see Dickson reference). - Gary Detlefs, May 22 2013
Not only are the squares of these primes the sum of two nonzero squares, but the primes themselves are also. 2 is the only prime equal to the sum of two nonzero squares and whose square is not. 2 is therefore not a Pythagorean prime. - Jean-Christophe Hervé, Nov 10 2013
The statement that these primes are the sum of two nonzero squares follows from Fermat's theorem on the sum of two squares. - Jerzy R Borysowicz, Jan 02 2019
The decompositions of the prime and its square into two nonzero squares are unique. - Jean-Christophe Hervé, Nov 11 2013. See the Dickson reference, Vol. II, (B) on p. 227. - Wolfdieter Lang, Jan 13 2015
p^e for p prime of the form 4*k+1 and e >= 1 is the sum of 2 nonzero squares. - Jon Perry, Nov 23 2014
Primes p such that the area of the isosceles triangle of sides (p, p, q) for some integer q is an integer. - Michel Lagneau, Dec 31 2014
This is the set of all primes that are the average of two squares. - Richard R. Forberg, Mar 01 2015
Numbers k such that ((k-3)!!)^2 == -1 (mod k). - Thomas Ordowski, Jul 28 2016
This is a subsequence of primes of A004431 and also of A016813. - Bernard Schott, Apr 30 2022
In addition to the comment from Jean-Christophe Hervé, Nov 10 2013: All powers as well as the products of any of these primes are the sum of two nonzero squares. They are terms of A001481, which is closed under multiplication. - Klaus Purath, Nov 19 2023
REFERENCES
David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
L. E. Dickson, "History of the Theory of Numbers", Chelsea Publishing Company, 1919, Vol I, page 386
L. E. Dickson, History of the Theory of Numbers, Carnegie Institution, Publ. No. 256, Vol. II, Washington D.C., 1920, p. 227.
M. du Sautoy, The Music of the Primes, Fourth Estate / HarperCollins, 2003; see p. 76.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math.Series 55, Tenth Printing, 1972.
Peter R. J. Asveld, On a Post's System of Tag. Bulletin of the EATCS 36 (1988), 96-102.
C. Banderier, Calcul de (-1/p)
J. Butcher, Mathematical Miniature 8: The Quadratic Residue Theorem, NZMS Newsletter, No. 75, April 1999.
Hing Lun Chan, Windmills of the minds: an algorithm for Fermat's Two Squares Theorem, arXiv:2112.02556 [cs.LO], 2021.
A. David Christopher, A partition-theoretic proof of Fermat's Two Squares Theorem, Discrete Mathematics, Volume 339, Issue 4, 6 April 2016, Pages 1410-1411.
J. E. Ewell, A Simple Proof of Fermat's Two-Square Theorem, The American Mathematical Monthly, Vol. 90, No. 9 (Nov., 1983), pp. 635-637.
Bernard Frénicle de Bessy, Méthode pour trouver la solution des problèmes par les exclusions. Abrégé des combinaisons. Des Quarrez magiques, in "Divers ouvrages de mathématiques et de physique, par MM. de l'Académie royale des sciences", (1693) "Troisième exemple", pp. 17-26, see in particular p. 25.
A. Granville and G. Martin, Prime number races, arXiv:math/0408319 [math.NT], 2004.
D. & C. Hazzlewood, Quadratic Reciprocity
Ernest G. Hibbs, Component Interactions of the Prime Numbers, Ph. D. Thesis, Capitol Technology Univ. (2022), see p. 33.
Lucas Lacasa, Bartolome Luque, Ignacio Gómez, and Octavio Miramontes, On a Dynamical Approach to Some Prime Number Sequences, Entropy 20.2 (2018): 131, also arXiv:1802.08349 [math.NT], 2018.
Carlos Rivera, Puzzle 968. Another property of primes 4m+1, The Prime Puzzles & Problems Connection.
D. Shanks, Review of "K. E. Kloss et al., Class number of primes of the form 4n+1", Math. Comp., 23 (1969), 213-214. [Annotated scanned preprint of review]
S. A. Shirali, A family portrait of primes-a case study in discrimination, Math. Mag. Vol. 70, No. 4 (Oct., 1997), pp. 263-272.
Rosemary Sullivan and Neil Watling, Independent divisibility pairs on the set of integers from 1 to n, INTEGERS 13 (2013) #A65.
Eric Weisstein's World of Mathematics, Wilson's Theorem
Eric Weisstein's World of Mathematics, Pythagorean Triples
Wolfram Research, The Gauss Reciprocity Law
G. Xiao, Two squares
D. Zagier, A One-Sentence Proof That Every Prime p == 1 (mod 4) Is a Sum of Two Squares, Am. Math. Monthly, Vol. 97, No. 2 (Feb 1990), p. 144. [From Wolfdieter Lang, Jan 17 2015 (thanks to Charles Nash)]
FORMULA
Odd primes of form x^2 + y^2, (x=A002331, y=A002330, with x < y) or of form u^2 + 4*v^2, (u = A002972, v = A002973, with u odd). - Lekraj Beedassy, Jul 16 2004
p^2 - 1 = 12*Sum_{i = 0..floor(p/4)} floor(sqrt(i*p)) where p = a(n) = 4*n + 1. [Shirali]
a(n) = A000290(A002972(n)) + A000290(2*A002973(n)) = A000290(A002331(n+1)) + A000290(A002330(n+1)). - Reinhard Zumkeller, Feb 16 2010
a(n) = A002972(n)^2 + (2*A002973(n))^2, n >= 1. See the Jean-Christophe Hervé Nov 11 2013 comment. - Wolfdieter Lang, Jan 13 2015
a(n) = 4*A005098(n) + 1. - Zak Seidov, Sep 16 2018
From Vaclav Kotesovec, Apr 30 2020: (Start)
Product_{k>=1} (1 - 1/a(k)^2) = A088539.
Product_{k>=1} (1 + 1/a(k)^2) = A243380.
Product_{k>=1} (1 - 1/a(k)^3) = A334425.
Product_{k>=1} (1 + 1/a(k)^3) = A334424.
Product_{k>=1} (1 - 1/a(k)^4) = A334446.
Product_{k>=1} (1 + 1/a(k)^4) = A334445.
Product_{k>=1} (1 - 1/a(k)^5) = A334450.
Product_{k>=1} (1 + 1/a(k)^5) = A334449. (End)
From Vaclav Kotesovec, May 05 2020: (Start)
Product_{k>=1} (1 + 1/A002145(k)) / (1 + 1/a(k)) = Pi/(4*A064533^2) = 1.3447728438248695625516649942427635670667319092323632111110962...
Product_{k>=1} (1 - 1/A002145(k)) / (1 - 1/a(k)) = Pi/(8*A064533^2) = 0.6723864219124347812758324971213817835333659546161816055555481... (End)
Sum_{k >= 1} 1/a(k)^s = (1/2) * Sum_{n >= 1 odd numbers} moebius(n) * log((2*n*s)! * zeta(n*s) * abs(EulerE(n*s - 1)) / (Pi^(n*s) * 2^(2*n*s) * BernoulliB(2*n*s) * (2^(n*s) + 1) * (n*s - 1)!))/n, s >= 3 odd number. - Dimitris Valianatos, May 21 2020
Legendre symbol (-1, a(n)) = +1, for n >= 1. - Wolfdieter Lang, Mar 03 2021
EXAMPLE
The following table shows the relationship between several closely related sequences:
Here p = A002144 = primes == 1 (mod 4), p = a^2+b^2 with a < b;
a = A002331, b = A002330, t_1 = ab/2 = A070151;
p^2 = c^2 + d^2 with c < d; c = A002366, d = A002365,
t_2 = 2ab = A145046, t_3 = b^2 - a^2 = A070079,
with {c,d} = {t_2, t_3}, t_4 = cd/2 = ab(b^2-a^2).
---------------------------------
p a b t_1 c d t_2 t_3 t_4
---------------------------------
5 1 2 1 3 4 4 3 6
13 2 3 3 5 12 12 5 30
17 1 4 2 8 15 8 15 60
29 2 5 5 20 21 20 21 210
37 1 6 3 12 35 12 35 210
41 4 5 10 9 40 40 9 180
53 2 7 7 28 45 28 45 630
...
a(7) = 53 = A002972(7)^2 + (2*A002973(7))^2 = 7^2 + (2*1)^2 = 49 + 4, and this is the only way. - Wolfdieter Lang, Jan 13 2015
MAPLE
a := []; for n from 1 to 500 do if isprime(4*n+1) then a := [op(a), 4*n+1]; fi; od: A002144 := n->a[n];
# alternative
A002144 := proc(n)
option remember ;
local a;
if n = 1 then
5;
else
for a from procname(n-1)+4 by 4 do
if isprime(a) then
return a;
end if;
end do:
end if;
end proc:
seq(A002144(n), n=1..100) ; # R. J. Mathar, Jan 31 2024
MATHEMATICA
Select[4*Range[140] + 1, PrimeQ[ # ] &] (* Stefan Steinerberger, Apr 16 2006 *)
Select[Prime[Range[150]], Mod[#, 4]==1&] (* Harvey P. Dale, Jan 28 2021 *)
PROG
(Haskell)
a002144 n = a002144_list !! (n-1)
a002144_list = filter ((== 1) . a010051) [1, 5..]
-- Reinhard Zumkeller, Mar 06 2012, Feb 22 2011
(Magma) [a: n in [0..200] | IsPrime(a) where a is 4*n + 1 ]; // Vincenzo Librandi, Nov 23 2014
(PARI) select(p->p%4==1, primes(1000))
(PARI)
A002144_next(p=A2144[#A2144])={until(isprime(p+=4), ); p} /* NB: p must be of the form 4k+1. Beyond primelimit, this is *much* faster than forprime(p=..., , p%4==1 && return(p)). */
A2144=List(5); A002144(n)={while(#A2144<n, listput(A2144, A002144_next())); A2144[n]}
\\ M. F. Hasler, Jul 06 2024
(Python)
from sympy import prime
A002144 = [n for n in (prime(x) for x in range(1, 10**3)) if not (n-1) % 4]
# Chai Wah Wu, Sep 01 2014
(Python)
from sympy import isprime
print(list(filter(isprime, range(1, 618, 4)))) # Michael S. Branicky, May 13 2021
(SageMath)
def A002144_list(n): # returns all Pythagorean primes <= n
return [x for x in prime_range(5, n+1) if x % 4 == 1]
A002144_list(617) # Peter Luschny, Sep 12 2012
CROSSREFS
Cf. A004613 (multiplicative closure).
Apart from initial term, same as A002313.
For values of n see A005098.
Primes in A020668.
KEYWORD
nonn,easy,nice
AUTHOR
STATUS
approved
A000404 Numbers that are the sum of 2 nonzero squares. +10
235
2, 5, 8, 10, 13, 17, 18, 20, 25, 26, 29, 32, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 72, 73, 74, 80, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 122, 125, 128, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 162, 164, 169, 170, 173, 178 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
From the formula it is easy to see that if k is in this sequence, then so are all odd powers of k. - T. D. Noe, Jan 13 2009
Also numbers whose cubes are the sum of two nonzero squares. - Joe Namnath and Lawrence Sze
A line perpendicular to y=mx has its first integral y-intercept at a^2+b^2. The remaining ones for that slope are multiples of that primitive value. - Larry J Zimmermann, Aug 19 2010
The primes in this sequence are sequence A002313.
Complement of A018825; A025426(a(n)) > 0; A063725(a(n)) > 0. - Reinhard Zumkeller, Aug 16 2011
If the two squares are not equal, then any power is still in the sequence: if k = x^2 + y^2 with x != y, then k^2 = (x^2-y^2)^2 + (2xy)^2 and k^3 = (x(x^2-3y^2))^2 + (y(3x^2-y^2))^2, etc. - Carmine Suriano, Jul 13 2012
There are never more than 3 consecutive terms that differ by 1. Triples of consecutive terms that differ by 1 occur infinitely many times, for example, 2(k^2 + k)^2, (k^2 - 1)^2 + (k^2 + 2 k)^2, and (k^2 + k - 1)^2 + (k^2 + k + 1)^2 for any integer k > 1. - Ivan Neretin, Mar 16 2017 [Corrected by Jerzy R Borysowicz, Apr 14 2017]
Number of terms less than 10^k, k=1,2,3,...: 3, 34, 308, 2690, 23873, 215907, 1984228, ... - Muniru A Asiru, Feb 01 2018
REFERENCES
David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 103.
E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 75, Theorem 4, with Theorem 2, p. 15.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
Ian Stewart, "Game, Set and Math", Chapter 8, 'Close Encounters of the Fermat Kind', Penguin Books, Ed. 1991, pp. 107-124.
LINKS
J. M. De Koninck and V. Ouellet, On the n-th element of a set of positive integers, Annales Univ. Sci. Budapest Sect. Comput. 44 (2015), 153-164. See 2. on p. 162.
Étienne Fouvry, Claude Levesque, and Michel Waldschmidt, Representation of integers by cyclotomic binary forms, arXiv:1712.09019 [math.NT], 2017.
Joshua Harrington, Lenny Jones, and Alicia Lamarche, Representing integers as the sum of two squares in the ring Z_n, arXiv:1404.0187 [math.NT], 2014.
David Rabahy, Google Sheets
G. Xiao, Two squares.
FORMULA
Let k = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 * ... * q_s^b_s with t >= 0, a_i >= 0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j == -1 (mod 4) for j=1..s. Then k is a term iff 1) b_j == 0 (mod 2) for j=1..s and 2) r > 0 or t == 1 (mod 2) (or both).
From Charles R Greathouse IV, Nov 18 2022: (Start)
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533.
There are B(x) = (x/sqrt(log x)) * (K + B2/log x + O(1/log^2 x)) terms of this sequence up to x, where K = A064533 and B2 = A227158. (End)
EXAMPLE
25 = 3^2 + 4^2, therefore 25 is a term. Note that also 25^3 = 15625 = 44^2 + 117^2, therefore 15625 is a term.
MAPLE
nMax:=178: A:={}: for i to floor(sqrt(nMax)) do for j to floor(sqrt(nMax)) do if i^2+j^2 <= nMax then A := `union`(A, {i^2+j^2}) else end if end do end do: A; # Emeric Deutsch, Jan 02 2017
MATHEMATICA
nMax=1000; n2=Floor[Sqrt[nMax-1]]; Union[Flatten[Table[a^2+b^2, {a, n2}, {b, a, Floor[Sqrt[nMax-a^2]]}]]]
Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {0, _} -> Nothing] > 0 &] (* Michael De Vlieger, Mar 24 2016 *)
Module[{upto=200}, Select[Union[Total/@Tuples[Range[Sqrt[upto]]^2, 2]], #<= upto&]] (* Harvey P. Dale, Sep 18 2021 *)
PROG
(PARI) is_A000404(n)= for( i=1, #n=factor(n)~%4, n[1, i]==3 && n[2, i]%2 && return); n && ( vecmin(n[1, ])==1 || (n[1, 1]==2 && n[2, 1]%2)) \\ M. F. Hasler, Feb 07 2009
(PARI) list(lim)=my(v=List(), x2); lim\=1; for(x=1, sqrtint(lim-1), x2=x^2; for(y=1, sqrtint(lim-x2), listput(v, x2+y^2))); Set(v) \\ Charles R Greathouse IV, Apr 30 2016
(Haskell)
import Data.List (findIndices)
a000404 n = a000404_list !! (n-1)
a000404_list = findIndices (> 0) a025426_list
-- Reinhard Zumkeller, Aug 16 2011
(Magma) lst:=[]; for n in [1..178] do f:=Factorization(n); if IsSquare(n) then for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 1 then Append(~lst, n); break; end if; end for; else t:=0; for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 3 and d[2] mod 2 eq 1 then t:=1; break; end if; end for; if t eq 0 then Append(~lst, n); end if; end if; end for; lst; // Arkadiusz Wesolowski, Feb 16 2017
(GAP) P:=List([1..10^4], i->i^2);;
A000404 := Set(Flat(List(P, i->List(P, j -> i+j)))); # Muniru A Asiru, Feb 01 2018
(Python)
from itertools import count, islice
from sympy import factorint
def A000404_gen(startvalue=1): # generator of terms >= startvalue
for n in count(max(startvalue, 1)):
c = False
for p in (f:=factorint(n)):
if (q:= p & 3)==3 and f[p]&1:
break
elif q == 1:
c = True
else:
if c or f.get(2, 0)&1:
yield n
A000404_list = list(islice(A000404_gen(), 30)) # Chai Wah Wu, Jul 01 2022
CROSSREFS
A001481 gives another version (allowing for zero squares).
Cf. A004431 (2 distinct squares), A063725 (number of representations), A024509 (numbers with multiplicity), A025284, A018825. Also A050803, A050801, A001105, A033431, A084888, A000578, A000290, A057961, A232499, A007692.
Cf. A003325 (analog for cubes), A003336 (analog for 4th powers).
Column k=2 of A336725.
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
Edited by Ralf Stephan, Nov 15 2004
Typo in formula corrected by M. F. Hasler, Feb 07 2009
Erroneous Mathematica program fixed by T. D. Noe, Aug 07 2009
PARI code fixed for versions > 2.5 by M. F. Hasler, Jan 01 2013
STATUS
approved
A002313 Primes congruent to 1 or 2 modulo 4; or, primes of form x^2 + y^2; or, -1 is a square mod p.
(Formerly M1430 N0564)
+10
127
2, 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 509, 521, 541, 557, 569, 577, 593, 601, 613, 617 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Or, primes p such that x^2 - p*y^2 represents -1.
Primes which are not Gaussian primes (meaning not congruent to 3 mod 4).
Every Fibonacci prime (with the exception of F(4) = 3) is in the sequence. If p = 2n+1 is the prime index of the Fibonacci prime, then F(2n+1) = F(n)^2 + F(n+1)^2 is the unique representation of the prime as sum of two squares. - Sven Simon, Nov 30 2003
Except for 2, primes of the form x^2 + 4y^2. See A140633. - T. D. Noe, May 19 2008
Primes p such that for all p > 2, p XOR 2 = p + 2. - Brad Clardy, Oct 25 2011
Greatest prime divisor of r^2 + 1 for some r. - Michel Lagneau, Sep 30 2012
Empirical result: a(n), as a set, compose the prime factors of the family of sequences produced by A005408(j)^2 + A005408(j+k)^2 = (2j+1)^2 + (2j+2k+1)^2, for j >= 0, and a given k >= 1 for each sequence, with the addition of the prime factors of k if not already in a(n). - Richard R. Forberg, Feb 09 2015
Primes such that when r is a primitive root then p-r is also a primitive root. - Emmanuel Vantieghem, Aug 13 2015
Primes of the form (x^2 + y^2)/2. Note that (x^2 + y^2)/2 = ((x+y)/2)^2 + ((x-y)/2)^2 = a^2 + b^2 with x = a + b and y = a - b. More generally, primes of the form (x^2 + y^2) / A001481(n) for every fixed n > 1. - Thomas Ordowski, Jul 03 2016
Numbers n such that ((n-2)!!)^2 == -1 (mod n). - Thomas Ordowski, Jul 25 2016
Primes p such that (p-1)!! == (p-2)!! (mod p). - Thomas Ordowski, Jul 28 2016
The product of 2 different terms (x^2 + y^2)(z^2 + v^2) = (xz + yv)^2 + (xv - yz)^2 is sum of 2 squares (A000404) because (xv - yz)^2 > 0. If x were equal to yz/v then (x^2 + y^2)/(z^2 + v^2) would be equal to ((yz/v)^2 + y^2)/(z^2 + v^2) = y^2/v^2 which is not possible because (x^2 + y^2) and (z^2 + v^2) are prime numbers. For example, (2^2 + 5^2)(4^2 + 9^2) = (2*4 + 5*9)^2 + (2*9 - 5*4)^2. - Jerzy R Borysowicz, Mar 21 2017
REFERENCES
M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 872.
David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
J. Todd, A problem on arc tangent relations, Amer. Math. Monthly, 56 (1949), 517-528.
Eric Weisstein's World of Mathematics, Fermat's 4n+1 Theorem
G. Xiao, Two squares
FORMULA
a(n) ~ 2n log n. - Charles R Greathouse IV, Jul 04 2016
a(n) = A002331(n)^2 + A002330(n)^2. See crossrefs. - Wolfdieter Lang, Dec 11 2016
EXAMPLE
13 is in the sequence since it is prime and 13 = 4*3 + 1. Also 13 = 2^2 + 3^2. And -1 is a square (mod 13): -1 + 2*13 = 25 = 5^2. Of course, only the first term is congruent to 2 (mod 4). - Michael B. Porter, Jul 04 2016
MAPLE
with(numtheory): for n from 1 to 300 do if ithprime(n) mod 4 = 1 or ithprime(n) mod 4 = 2 then printf(`%d, `, ithprime(n)) fi; od:
# alternative
A002313 := proc(n)
option remember ;
local a;
if n = 1 then
2;
elif n = 2 then
5;
else
for a from procname(n-1)+4 by 4 do
if isprime(a) then
return a ;
end if;
end do:
end if;
end proc:
seq(A002313(n), n=1..100) ; # R. J. Mathar, Feb 01 2024
MATHEMATICA
Select[ Prime@ Range@ 115, Mod[#, 4] != 3 &] (* Robert G. Wilson v *)
fQ[n_] := Solve[x^2 + 1 == n*y^2, {x, y}, Integers] == {}; Select[ Prime@ Range@ 115, fQ] (* Robert G. Wilson v, Dec 19 2013 *)
PROG
(PARI) select(p->p%4!=3, primes(1000)) \\ Charles R Greathouse IV, Feb 11 2011
(Haskell)
a002313 n = a002313_list !! (n-1)
a002313_list = filter ((`elem` [1, 2]) . (`mod` 4)) a000040_list
-- Reinhard Zumkeller, Feb 04 2014
(Magma) [p: p in PrimesUpTo(700) | p mod 4 in {1, 2}]; // Vincenzo Librandi, Feb 18 2015
CROSSREFS
Apart from initial term, same as A002144. For values of x and y see A002330 and A002331.
KEYWORD
nonn,easy,nice
AUTHOR
EXTENSIONS
More terms from Henry Bottomley, Aug 10 2000
More terms from James A. Sellers, Aug 22 2000
STATUS
approved
A004018 Theta series of square lattice (or number of ways of writing n as a sum of 2 squares). Often denoted by r(n) or r_2(n).
(Formerly M3218)
+10
123
1, 4, 4, 0, 4, 8, 0, 0, 4, 4, 8, 0, 0, 8, 0, 0, 4, 8, 4, 0, 8, 0, 0, 0, 0, 12, 8, 0, 0, 8, 0, 0, 4, 0, 8, 0, 4, 8, 0, 0, 8, 8, 0, 0, 0, 8, 0, 0, 0, 4, 12, 0, 8, 8, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 4, 16, 0, 0, 8, 0, 0, 0, 4, 8, 8, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 16, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 8, 4, 0, 12, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
Number of points in square lattice on the circle of radius sqrt(n). Equivalently, number of Gaussian integers of norm n (cf. Conway-Sloane, p. 106).
Let b(n)=A004403(n), then Sum_{k=1..n} a(k)*b(n-k) = 1. - John W. Layman
Theta series of D_2 lattice.
Number 6 of the 74 eta-quotients listed in Table I of Martin (1996).
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
The zeros in this sequence correspond to those integers with an equal number of 4k+1 and 4k+3 divisors, or equivalently to those that have at least one 4k+3 prime factor with an odd exponent (A022544). - Ant King, Mar 12 2013
If A(q) = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + ... denotes the o.g.f. of this sequence then the function F(q) := 1/4*(A(q^2) - A(q^4)) = ( Sum_{n >= 0} q^(2*n+1)^2 )^2 is the o.g.f. for counting the ways a positive integer n can be written as the sum of two positive odd squares. - Peter Bala, Dec 13 2013
Expansion coefficients of (2/Pi)*K, with the real quarter period K of elliptic functions, as series of the Jacobi nome q, due to (2/Pi)*K = theta_3(0,q)^2. See, e.g., Whittaker-Watson, p. 486. - Wolfdieter Lang, Jul 15 2016
Sum_{k=0..n} a(n) = A057655(n). Robert G. Wilson v, Dec 22 2016
Limit_{n->oo} (a(n)/n - Pi*log(n)) = A062089: Sierpinski's constant. - Robert G. Wilson v, Dec 22 2016
The mean value of a(n) is Pi, see A057655 for more details. - M. F. Hasler, Mar 20 2017
REFERENCES
L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 162, #16 (7), r(n).
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.23).
E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 15, p. 32, Lemma 2 (with the proof), p. 116, (9.10) first formula.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 240, r(n).
W. König and J. Sprekels, Karl Weierstraß (1815-1897), Springer Spektrum, Wiesbaden, 2016, p. 186-187 and p. 280-281.
C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 51.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, fourth edition, reprinted, 1958, Cambridge at the University Press.
LINKS
G. E. Andrews, R. Lewis and Z.-G. Liu, An identity relating a theta series to a sum of Lambert series, Bull. London Math. Soc., 33 (2001), 25-31.
H. H. Chan and C. Krattenthaler, Recent progress in the study of representations of integers as sums of squares, arXiv:math/0407061 [math.NT], 2004.
S. Cooper and M. Hirschhorn, A combinatorial proof of a result from number theory, Integers 4 (2004), #A09.
J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math. 38 (1907), 1-62. (This sequence is called rho, see page 6)
M. D. Hirschhorn, The number of representations of a number by various forms, Discrete Mathematics 298 (2005), 205-211.
Jacobi-Legendre letters, Correspondance mathématique entre Legendre et Jacobi, J. Reine Angew. Math. 80 (1875) 205-279, letter of September 9, 1828, p. 240-243, formula for 2K/Pi on p. 242.
Christian Kassel and Christophe Reutenauer, The zeta function of the Hilbert scheme of n points on a two-dimensional torus, arXiv:1505.07229v3 [math.AG], 2015. [Note that a later version of this paper has a different title and different contents, and the number-theoretical part of the paper was moved to the publication which is next in this list.]
Christian Kassel and Christophe Reutenauer, Complete determination of the zeta function of the Hilbert scheme of n points on a two-dimensional torus, arXiv:1610.07793 [math.NT], 2016.
Christian Kassel, Christophe Reutenauer, The Fourier expansion of eta(z)eta(2z)eta(3z)/eta(6z), arXiv:1603.06357 [math.NT], 2016.
M. Kontsevich and D. Zagier, Periods, Institut des Hautes Etudes Scientifiques 2001 IHES/M/01/22. Published in B. Engquist and W. Schmid, editors, Mathematics Unlimited - 2001 and Beyond, 2 vols., Springer-Verlag, 2001, pp. 771-808, section 2.3. Example 3.
Y. Martin, Multiplicative eta-quotients, Trans. Amer. Math. Soc. 348 (1996), no. 12, 4825-4856, see page 4852 Table I.
G. Nebe and N. J. A. Sloane, Home page for this lattice
Grant Sanderson, Pi hiding in prime regularities, 3Blue1Brown video (2017).
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
G. Villemin, Sommes de 2 carrés
Eric Weisstein's World of Mathematics, Barnes-Wall Lattice
Eric Weisstein's World of Mathematics, Moebius Transform
Eric Weisstein's World of Mathematics, Ramanujan Theta Functions
Eric Weisstein's World of Mathematics, Sum of Squares Function
Eric Weisstein's World of Mathematics, Theta Series
Zach Wissner-Gross a.k.a. The Riddler, Riddler Express: Can You Climb Your Way To Victory?, FiveThirtyEight, Sep 24 2021.
G. Xiao, Two squares
FORMULA
Expansion of theta_3(q)^2 = (Sum_{n=-oo..+oo} q^(n^2))^2 = Product_{m>=1} (1-q^(2*m))^2 * (1+q^(2*m-1))^4.
Factor n as n = p1^a1 * p2^a2 * ... * q1^b1 * q2^b2 * ... * 2^c, where the p's are primes == 1 (mod 4) and the q's are primes == 3 (mod 4). Then a(n) = 0 if any b is odd, otherwise a(n) = 4*(1 + a1)*(1 + a2)*...
G.f. = s(2)^10/(s(1)^4*s(4)^4), where s(k) := subs(q=q^k, eta(q)) and eta(q) is Dedekind's function, cf. A010815. [Fine]
a(n) = 4*A002654(n), n > 0.
Expansion of eta(q^2)^10 / (eta(q) * eta(q^4))^4 in powers of q. - Michael Somos, Jul 19 2004
Expansion of ( phi(q)^2 + phi(-q)^2 ) / 2 in powers of q^2 where phi() is a Ramanujan theta function.
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (u - v)^2 - (v - w) * 4 * w. - Michael Somos, Jul 19 2004
Euler transform of period 4 sequence [4, -6, 4, -2, ...]. - Michael Somos, Jul 19 2004
Moebius transform is period 4 sequence [4, 0, -4, 0, ...]. - Michael Somos, Sep 17 2007
G.f. is a period 1 Fourier series which satisfies f(-1 / (4 t)) = 2 (t/i) f(t) where q = exp(2 Pi i t).
The constant sqrt(Pi)/Gamma(3/4)^2 produces the first 324 terms of the sequence when expanded in base exp(Pi), 450 digits of the constant are necessary. - Simon Plouffe, Mar 03 2011
a(n) = A004531(4*n). a(n) = 2*A105673(n), if n>0.
Let s = 16*q*(E1*E4^2/E2^3)^8 where Ek = Product_{n>=1} (1-q^(k*n)) (s=k^2 where k is elliptic k), then the g.f. is hypergeom([+1/2, +1/2], [+1], s) (expansion of 2/Pi*ellipticK(k) in powers of q). - Joerg Arndt, Aug 15 2011
Dirichlet g.f. Sum_{n>=1} a(n)/n^s = 4*zeta(s)*L_(-4)(s), where L is the D.g.f. of the (shifted) A056594. [Raman. J. 7 (2003) 95-127]. - R. J. Mathar, Jul 02 2012
a(n) = floor(1/(n+1)) + 4*floor(cos(Pi*sqrt(n))^2) - 4*floor(cos(Pi*sqrt(n/2))^2) + 8*Sum_{i=1..floor(n/2)} floor(cos(Pi*sqrt(i))^2)*floor(cos(Pi*sqrt(n-i))^2). - Wesley Ivan Hurt, Jan 09 2013
From Wolfdieter Lang, Aug 01 2016: (Start)
A Jacobi identity: theta_3(0, q)^2 = 1 + 4*Sum_{r>=0} (-1)^r*q^(2*r+1)/(1 - q^(2*r+1)). See, e.g., the Grosswald reference (p. 15, p. 116, but p. 32, Lemma 2 with the proof, has the typo r >= 1 instead of r >= 0 in the sum, also in the proof). See the link with the Jacobi-Legendre letter.
Identity used by Weierstraß (see the König-Sprekels book, p. 187, eq. (5.12) and p. 281, with references, but there F(x) from (5.11) on p. 186 should start with nu =1 not 0): theta_3(0, q)^2 = 1 + 4*Sum_{n>=1} q^n/(1 + q^(2*n)). Proof: similar to the one of the preceding Jacobi identity. (End)
a(n) = (4/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
G.f.: Theta_3(q)^2 = hypergeometric([1/2, 1/2],[1],lambda(q)), with lambda(q) = Sum_{j>=1} A115977(j)*q^j. See the Kontsevich and Zagier link, with Theta -> Theta_3, z -> 2*z and q -> q^2. - Wolfdieter Lang, May 27 2018
EXAMPLE
G.f. = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + 4*q^8 + 4*q^9 + 8*q^10 + 8*q^13 + 4*q^16 + 8*q^17 + 4*q^18 + 8*q^20 + 12*q^25 + 8*q^26 + ... . - John Cannon, Dec 30 2006
MAPLE
(sum(x^(m^2), m=-10..10))^2;
# Alternative:
A004018list := proc(len) series(JacobiTheta3(0, x)^2, x, len+1);
seq(coeff(%, x, j), j=0..len-1) end:
t1 := A004018list(102);
r2 := n -> t1[n+1]; # Peter Luschny, Oct 02 2018
MATHEMATICA
SquaresR[2, Range[0, 110]] (* Harvey P. Dale, Oct 10 2011 *)
a[ n_] := SquaresR[ 2, n]; (* Michael Somos, Nov 15 2011 *)
a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^2, {q, 0, n}]; (* Michael Somos, Nov 15 2011 *)
a[ n_] := With[{m = InverseEllipticNomeQ @ q}, SeriesCoefficient[ EllipticK[ m] / (Pi/2), {q, 0, n}]]; (* Michael Somos, Jun 10 2014 *)
a[ n_] := If[ n < 1, Boole[n == 0], 4 Sum[ KroneckerSymbol[-4, d], {d, Divisors@n}]]; (* or *) a[ n_] := SeriesCoefficient[ QPochhammer[ q^2]^10/(QPochhammer[ q] QPochhammer[ q^4])^4, {q, 0, n}]; (* Michael Somos, May 17 2015 *)
PROG
(PARI) {a(n) = polcoeff( 1 + 4 * sum( k=1, n, x^k / (1 + x^(2*k)), x * O(x^n)), n)}; /* Michael Somos, Mar 14 2003 */
(PARI) {a(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)))}; /* Michael Somos, Jul 19 2004 */
(PARI) {a(n) = if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 1], n)[n])}; /* Michael Somos, May 13 2005 */
(PARI) a(n)=if(n==0, return(1)); my(f=factor(n)); 4*prod(i=1, #f~, if(f[i, 1]%4==1, f[i, 2]+1, if(f[i, 2]%2 && f[i, 1]>2, 0, 1))) \\ Charles R Greathouse IV, Sep 02 2015
(Magma) Basis( ModularForms( Gamma1(4), 1), 100) [1]; /* Michael Somos, Jun 10 2014 */
(Sage)
Q = DiagonalQuadraticForm(ZZ, [1]*2)
Q.representation_number_list(102) # Peter Luschny, Jun 20 2014
(Julia) # JacobiTheta3 is defined in A000122.
A004018List(len) = JacobiTheta3(len, 2)
A004018List(102) |> println # Peter Luschny, Mar 12 2018
(Python)
from sympy import factorint
def a(n):
if n == 0: return 1
an = 4
for pi, ei in factorint(n).items():
if pi%4 == 1: an *= ei+1
elif pi%4 == 3 and ei%2: return 0
return an
print([a(n) for n in range(102)]) # Michael S. Branicky, Sep 24 2021
(Python)
from math import prod
from sympy import factorint
def A004018(n): return prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in factorint(n).items())<<2 if n else 1 # Chai Wah Wu, Jul 07 2022, corrected Jun 21 2024.
CROSSREFS
Row d=2 of A122141 and of A319574, 2nd column of A286815.
Partial sums - 1 give A014198.
A071385 gives records; A071383 gives where records occur.
KEYWORD
nonn,easy,nice,core
AUTHOR
STATUS
approved
A002654 Number of ways of writing n as a sum of at most two nonzero squares, where order matters; also (number of divisors of n of form 4m+1) - (number of divisors of form 4m+3).
(Formerly M0012 N0001)
+10
105
1, 1, 0, 1, 2, 0, 0, 1, 1, 2, 0, 0, 2, 0, 0, 1, 2, 1, 0, 2, 0, 0, 0, 0, 3, 2, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 1, 3, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 1, 4, 0, 0, 2, 0, 0, 0, 1, 2, 2, 0, 0, 0, 0, 0, 2, 1, 2, 0, 0, 4, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 1, 0, 3, 2, 0, 0, 2, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
COMMENTS
Glaisher calls this E(n) or E_0(n). - N. J. A. Sloane, Nov 24 2018
Number of sublattices of Z X Z of index n that are similar to Z X Z; number of (principal) ideals of Z[i] of norm n.
a(n) is also one fourth of the number of integer solutions of n = x^2 + y^2 (order and signs matter, and 0 (without signs) is allowed). a(n) = N(n)/4, with N(n) from p. 147 of the Niven-Zuckermann reference. See also Theorem 5.12, p. 150, which defines a (strongly) multiplicative function h(n) which coincides with A056594(n-1), n >= 1, and N(n)/4 = sum(h(d), d divides n). - Wolfdieter Lang, Apr 19 2013
a(2+8*N) = A008441(N) gives the number of ways of writing N as the sum of 2 (nonnegative) triangular numbers for N >= 0. - Wolfdieter Lang, Jan 12 2017
Coefficients of Dedekind zeta function for the quadratic number field of discriminant -4. See A002324 for formula and Maple code. - N. J. A. Sloane, Mar 22 2022
REFERENCES
J. M. Borwein, D. H. Bailey and R. Girgensohn, Experimentation in Mathematics, A K Peters, Ltd., Natick, MA, 2004. x+357 pp. See p. 194.
George Chrystal, Algebra: An elementary text-book for the higher classes of secondary schools and for colleges, 6th ed., Chelsea Publishing Co., New York, 1959, Part II, p. 346 Exercise XXI(17). MR0121327 (22 #12066)
Emil Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 15.
Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers, New York: John Wiley, 1980, pp. 147 and 150.
Günter Scheja and Uwe Storch, Lehrbuch der Algebra, Tuebner, 1988, p. 251.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 340.
LINKS
Michael Baake, Solution of the coincidence problem in dimensions d <= 4, in R. V. Moody, ed., The Mathematics of Long-Range Aperiodic Order, Kluwer 1997, pp. 9-44; arXiv:math/0605222 [math.MG], 2006.
Michael Baake and Uwe Grimm, Quasicrystalline combinatorics, 2002.
Shai Covo, Problem 3586, Crux Mathematicorum, Vol. 36, No. 7 (2010), pp. 461 and 463; Solution to Problem 3586 by the proposer, ibid., Vol. 37, No. 7 (2011), pp. 477-479.
J. W. L. Glaisher, On the function chi(n), Quarterly Journal of Pure and Applied Mathematics, Vol. 20 (1884), pp. 97-167.
J. W. L. Glaisher, On the function chi(n), Quarterly Journal of Pure and Applied Mathematics, Vol. 20 (1884), pp. 97-167. [Annotated scanned copy]
J. W. L. Glaisher, On the function which denotes the difference between the number of (4m+1)-divisors and the number of (4m+3)-divisors of a number, Proc. London Math. Soc., Vol. 15 (1884), pp. 104-122. [Annotated scanned copy of pages 104-107 only]
J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math., Vol. 38 (1907), pp. 1-62 (see p. 4 and p. 8).
Srinivasa Ramanujan, Some formulas in the analytic theory of numbers, Messenger of Mathematics, XLV, 1916, 81-84, section (K).
FORMULA
Dirichlet series: (1-2^(-s))^(-1)*Product (1-p^(-s))^(-2) (p=1 mod 4) * Product (1-p^(-2s))^(-1) (p=3 mod 4) = Dedekind zeta-function of Z[ i ].
Coefficients in expansion of Dirichlet series Product_p (1-(Kronecker(m, p)+1)*p^(-s)+Kronecker(m, p)*p^(-2s))^(-1) for m = -16.
If n=2^k*u*v, where u is product of primes 4m+1, v is product of primes 4m+3, then a(n)=0 unless v is a square, in which case a(n) = number of divisors of u (Jacobi).
Multiplicative with a(p^e) = 1 if p = 2; e+1 if p == 1 (mod 4); (e+1) mod 2 if p == 3 (mod 4). - David W. Wilson, Sep 01 2001
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (u - v)^2 - (v - w) * (4*w + 1). - Michael Somos, Jul 19 2004
G.f.: Sum_{n>=1} ((-1)^floor(n/2)*x^((n^2+n)/2)/(1+(-x)^n)). - Vladeta Jovovic, Sep 15 2004
Expansion of (eta(q^2)^10 / (eta(q) * eta(q^4))^4 - 1)/4 in powers of q.
G.f.: Sum_{k>0} x^k / (1 + x^(2*k)) = Sum_{k>0} -(-1)^k * x^(2*k - 1) / (1 - x^(2*k - 1)). - Michael Somos, Aug 17 2005
a(4*n + 3) = a(9*n + 3) = a(9*n + 6) = 0. a(9*n) = a(2*n) = a(n). - Michael Somos, Nov 01 2006
a(4*n + 1) = A008441(n). a(3*n + 1) = A122865(n). a(3*n + 2) = A122856(n). a(12*n + 1) = A002175(n). a(12*n + 5) = 2 * A121444(n). 4 * a(n) = A004018(n) unless n=0.
a(n) = Sum_{k=1..n} A010052(k)*A010052(n-k). a(A022544(n)) = 0; a(A001481(n)) > 0.
- Reinhard Zumkeller, Sep 27 2008
a(n) = A001826(n) - A001842(n). - R. J. Mathar, Mar 23 2011
a(n) = Sum_{d|n} A056594(d-1), n >= 1. See the above comment on A056594(d-1) = h(d) of the Niven-Zuckerman reference. - Wolfdieter Lang, Apr 19 2013
Dirichlet g.f.: zeta(s)*beta(s) = zeta(s)*L(chi_2(4),s). - Ralf Stephan, Mar 27 2015
G.f.: (theta_3(x)^2 - 1)/4, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 17 2018
a(n) = Sum_{ m: m^2|n } A000089(n/m^2). - Andrey Zabolotskiy, May 07 2018
a(n) = A053866(n) + 2 * A025441(n). - Andrey Zabolotskiy, Apr 23 2019
a(n) = Im(Sum_{d|n} i^d). - Ridouane Oudra, Feb 02 2020
a(n) = Sum_{d|n} sin((1/2)*d*Pi). - Ridouane Oudra, Jan 22 2021
Sum_{n>=1} (-1)^n*a(n)/n = Pi*log(2)/4 (Covo, 2010). - Amiram Eldar, Apr 07 2022
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/4 = 0.785398... (A003881). - Amiram Eldar, Oct 11 2022
From Vaclav Kotesovec, Mar 10 2023: (Start)
Sum_{k=1..n} a(k)^2 ~ n * (log(n) + C) / 4, where C = A241011 =
4*gamma - 1 + log(2)/3 - 2*log(Pi) + 8*log(Gamma(3/4)) - 12*Zeta'(2)/Pi^2 = 2.01662154573340811526279685971511542645018417752364748061...
The constant C, published by Ramanujan (1916, formula (22)), 4*gamma - 1 + log(2)/3 - log(Pi) + 4*log(Gamma(3/4)) - 12*Zeta'(2)/Pi^2 = 2.3482276258576... is wrong! (End)
EXAMPLE
4 = 2^2, so a(4) = 1; 5 = 1^2 + 2^2 = 2^2 + 1^2, so a(5) = 2.
x + x^2 + x^4 + 2*x^5 + x^8 + x^9 + 2*x^10 + 2*x^13 + x^16 + 2*x^17 + x^18 + ...
2 = (+1)^2 + (+1)^2 = (+1)^2 + (-1)^2 = (-1)^2 + (+1)^2 = (-1)^2 + (-1)^2. Hence there are 4 integer solutions, called N(2) in the Niven-Zuckerman reference, and a(2) = N(2)/4 = 1. 4 = 0^1 + (+2)^2 = (+2)^2 + 0^2 = 0^2 + (-2)^2 = (-2)^2 + 0^2. Hence N(4) = 4 and a(4) = N(4)/4 = 1. N(5) = 8, a(5) = 2. - Wolfdieter Lang, Apr 19 2013
MAPLE
with(numtheory):
A002654 := proc(n)
local count1, count3, d;
count1 := 0:
count3 := 0:
for d in numtheory[divisors](n) do
if d mod 4 = 1 then
count1 := count1+1
elif d mod 4 = 3 then
count3 := count3+1
fi:
end do:
count1-count3;
end proc:
# second Maple program:
a:= n-> add(`if`(d::odd, (-1)^((d-1)/2), 0), d=numtheory[divisors](n)):
seq(a(n), n=1..100); # Alois P. Heinz, Feb 04 2020
MATHEMATICA
a[n_] := Count[Divisors[n], d_ /; Mod[d, 4] == 1] - Count[Divisors[n], d_ /; Mod[d, 4] == 3]; a/@Range[105] (* Jean-François Alcover, Apr 06 2011, after R. J. Mathar *)
QP = QPochhammer; CoefficientList[(1/q)*(QP[q^2]^10/(QP[q]*QP[q^4])^4-1)/4 + O[q]^100, q] (* Jean-François Alcover, Nov 24 2015 *)
f[2, e_] := 1; f[p_, e_] := If[Mod[p, 4] == 1, e + 1, Mod[e + 1, 2]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 19 2020 *)
Rest[CoefficientList[Series[EllipticTheta[3, 0, q]^2/4, {q, 0, 100}], q]] (* Vaclav Kotesovec, Mar 10 2023 *)
PROG
(PARI) direuler(p=2, 101, 1/(1-X)/(1-kronecker(-4, p)*X))
(PARI) {a(n) = polcoeff( sum(k=1, n, x^k / (1 + x^(2*k)), x * O(x^n)), n)}
(PARI) {a(n) = sumdiv( n, d, (d%4==1) - (d%4==3))}
(PARI) {a(n) = local(A); A = x * O(x^n); polcoeff( eta(x^2 + A)^10 / (eta(x + A) * eta(x^4 + A))^4 / 4, n)} \\ Michael Somos, Jun 03 2005
(PARI) a(n)=my(f=factor(n>>valuation(n, 2))); prod(i=1, #f~, if(f[i, 1]%4==1, f[i, 2]+1, (f[i, 2]+1)%2)) \\ Charles R Greathouse IV, Sep 09 2014
(PARI) my(B=bnfinit(x^2+1)); vector(100, n, #bnfisintnorm(B, n)) \\ Joerg Arndt, Jun 01 2024
(Haskell)
a002654 n = product $ zipWith f (a027748_row m) (a124010_row m) where
f p e | p `mod` 4 == 1 = e + 1
| otherwise = (e + 1) `mod` 2
m = a000265 n
-- Reinhard Zumkeller, Mar 18 2013
(Python)
from math import prod
from sympy import factorint
def A002654(n): return prod(1 if p == 2 else (e+1 if p % 4 == 1 else (e+1) % 2) for p, e in factorint(n).items()) # Chai Wah Wu, May 09 2022
CROSSREFS
Equals 1/4 of A004018. Partial sums give A014200.
Cf. A002175, A008441, A121444, A122856, A122865, A022544, A143574, A000265, A027748, A124010, A025426 (two squares, order does not matter), A120630 (Dirichlet inverse), A101455 (Mobius transform), A000089, A241011.
If one simply reads the table in Glaisher, PLMS 1884, which omits the zero entries, one gets A213408.
Dedekind zeta functions for imaginary quadratic number fields of discriminants -3, -4, -7, -8, -11, -15, -19, -20 are A002324, A002654, A035182, A002325, A035179, A035175, A035171, A035170, respectively.
Dedekind zeta functions for real quadratic number fields of discriminants 5, 8, 12, 13, 17, 21, 24, 28, 29, 33, 37, 40 are A035187, A035185, A035194, A035195, A035199, A035203, A035188, A035210, A035211, A035215, A035219, A035192, respectively.
KEYWORD
core,easy,nonn,nice,mult
AUTHOR
STATUS
approved
A002828 Least number of squares that add up to n.
(Formerly M0404 N0155)
+10
91
0, 1, 2, 3, 1, 2, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 3, 1, 2, 3, 4, 2, 3, 4, 2, 3, 2, 3, 1, 2, 3, 4, 2, 2, 3, 3, 3, 2, 3, 4, 3, 1, 2, 3, 2, 2, 3, 4, 3, 3, 2, 3, 4, 2, 3, 4, 1, 2, 3, 3, 2, 3, 3, 4, 2, 2, 2, 3, 3, 3, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 3, 2, 2, 3, 4, 3, 3, 4, 3, 2, 2, 3, 1, 2, 3, 4, 2, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Lagrange's "Four Squares theorem" states that a(n) <= 4.
It is easy to show that this is also the least number of squares that add up to n^3.
a(n) is the number of iterations in f(...f(f(n))...) to reach 0, where f(n) = A262678(n) = n - A262689(n)^2. Allows computation of this sequence without Lagrange's theorem. - Antti Karttunen, Sep 09 2016
It is also easy to show that a(k^2*n) = a(n) for k > 0: Clearly a(k^2*n) <= a(n) but for all 4 cases of a(n) there is no k which would result in a(k^2*n) < a(n). - Peter Schorn, Sep 06 2021
REFERENCES
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000 (first 1001 terms from T. D. Noe with corrections from Michel Marcus)
F. Michel Dekking, Morphisms, Symbolic Sequences, and Their Standard Forms, Journal of Integer Sequences, Vol. 19 (2016), Article 16.1.1.
N. J. A. Sloane, Transforms.
Eric Weisstein's World of Mathematics, Square Number.
FORMULA
From Antti Karttunen, Sep 09 2016: (Start)
a(0) = 0; and for n >= 1, if A010052(n) = 1 [when n is a square], a(n) = 1, otherwise, if A229062(n)=1, then a(n) = 2, otherwise a(n) = 3 + A072401(n). [After Charles R Greathouse IV's PARI program.]
a(0) = 0; for n >= 1, a(n) = 1 + a(n - A262689(n)^2), (see comments).
a(n) = A053610(n) - A062535(n).
(End)
MAPLE
with(transforms);
sq:=[seq(n^2, n=1..20)];
LAGRANGE(sq, 4, 120);
# alternative:
f:= proc(n) local F, x;
if issqr(n) then return 1 fi;
if nops(select(t -> t[1] mod 4 = 3 and t[2]::odd, ifactors(n)[2])) = 0 then return 2 fi;
x:= n/4^floor(padic:-ordp(n, 2)/2);
if x mod 8 = 7 then 4 else 3 fi
end proc:
0, seq(f(n), n=1..200); # Robert Israel, Jun 14 2016
# next Maple program:
b:= proc(n, i) option remember; convert(series(`if`(n=0, 1, `if`(i<1, 0,
b(n, i-1)+(s-> `if`(s>n, 0, x*b(n-s, i)))(i^2))), x, 5), polynom)
end:
a:= n-> ldegree(b(n, isqrt(n))):
seq(a(n), n=0..105); # Alois P. Heinz, Oct 30 2021
MATHEMATICA
SquareCnt[n_] := If[SquaresR[1, n] > 0, 1, If[SquaresR[2, n] > 0, 2, If[SquaresR[3, n] > 0, 3, 4]]]; Table[SquareCnt[n], {n, 150}] (* T. D. Noe, Apr 01 2011 *)
sc[n_]:=Module[{s=SquaresR[Range[4], n]}, If[First[s]>0, 1, Length[ First[ Split[ s]]]+1]]; Join[{0}, Array[sc, 110]] (* Harvey P. Dale, May 21 2014 *)
PROG
(PARI) istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
a(n)=if(isthree(n), if(issquare(n), !!n, 3-istwo(n)), 4) \\ Charles R Greathouse IV, Jul 19 2011, revised Mar 17 2022
(Haskell)
a002828 0 = 0 -- confessedly /= 1, as sum [] == 0
a002828 n | a010052 n == 1 = 1
| a025426 n > 0 = 2 | a025427 n > 0 = 3 | otherwise = 4
-- Reinhard Zumkeller, Feb 26 2015
(Scheme)
;; The first one follows Charles R Greathouse IV's PARI-code above:
(define (A002828 n) (cond ((zero? n) n) ((= 1 (A010052 n)) 1) ((= 1 (A229062 n)) 2) (else (+ 3 (A072401 n)))))
(define (A229062 n) (- 1 (A000035 (A260728 n))))
;; We can also compute this without relying on Lagrange's theorem. The following recursion-formula should be used together with the second Scheme-implementation of A262689 given in the Program section that entry:
(definec (A002828 n) (if (zero? n) n (+ 1 (A002828 (- n (A000290 (A262689 n)))))))
;; Antti Karttunen, Sep 09 2016
(Python)
from sympy import factorint
def A002828(n):
if n == 0: return 0
f = factorint(n).items()
if not any(e&1 for p, e in f): return 1
if all(p&3<3 or e&1^1 for p, e in f): return 2
return 3+(((m:=(~n&n-1).bit_length())&1^1)&int((n>>m)&7==7)) # Chai Wah Wu, Aug 01 2023
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
EXTENSIONS
More terms from Arlin Anderson (starship1(AT)gmail.com)
STATUS
approved
A000161 Number of partitions of n into 2 squares. +10
64
1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,26
COMMENTS
Number of ways of writing n as a sum of 2 (possibly zero) squares when order does not matter.
Number of similar sublattices of square lattice with index n.
Let Pk = the number of partitions of n into k nonzero squares. Then we have A000161 = P0 + P1 + P2, A002635 = P0 + P1 + P2 + P3 + P4, A010052 = P1, A025426 = P2, A025427 = P3, A025428 = P4. - Charles R Greathouse IV, Mar 08 2010, amended by M. F. Hasler, Jan 25 2013
a(A022544(n))=0; a(A001481(n))>0; a(A125022(n))=1; a(A118882(n))>1. - Reinhard Zumkeller, Aug 16 2011
REFERENCES
J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 339
LINKS
B. K. Agarwala and F. C. Auluck, Statistical mechanics and partitions into non-integral powers of integers, Proc. Camb. Phil. Soc., 47 (1951), 207-216. [Annotated scanned copy]
R. T. Bumby, Sums of four squares, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.
J. H. Conway, E. M. Rains and N. J. A. Sloane, On the existence of similar sublattices, Canad. J. Math. 51 (1999), 1300-1306 (Abstract, pdf, ps).
E. Grosswald, Representations of Integers as Sums of Squares, Springer-Verlag, NY, 1985, p. 84.
M. D. Hirschhorn, Some formulas for partitions into squares, Discrete Math, 211 (2000), pp. 225-228. [From Ant King, Oct 05 2010]
FORMULA
a(n) = card { { a,b } c N | a^2+b^2 = n }. - M. F. Hasler, Nov 23 2007
Let f(n)= the number of divisors of n that are congruent to 1 modulo 4 minus the number of its divisors that are congruent to 3 modulo 4, and define delta(n) to be 1 if n is a perfect square and 0 otherwise. Then a(n)=1/2 (f(n)+delta(n)+delta(1/2 n)). - Ant King, Oct 05 2010
EXAMPLE
25 = 3^2+4^2 = 5^2, so a(25) = 2.
MAPLE
A000161 := proc(n) local i, j, ans; ans := 0; for i from 0 to n do for j from i to n do if i^2+j^2=n then ans := ans+1 fi od od; RETURN(ans); end; [ seq(A000161(i), i=0..50) ];
A000161 := n -> nops( numtheory[sum2sqr](n) ); # M. F. Hasler, Nov 23 2007
MATHEMATICA
Length[PowersRepresentations[ #, 2, 2]] &/@Range[0, 150] (* Ant King, Oct 05 2010 *)
PROG
(PARI) a(n)=sum(i=0, n, sum(j=0, i, if(i^2+j^2-n, 0, 1))) \\ for illustrative purpose
(PARI) A000161(n)=sum(k=sqrtint((n-1)\2)+1, sqrtint(n), issquare(n-k^2)) \\ Charles R Greathouse IV, Mar 21 2014, improves earlier code by M. F. Hasler, Nov 23 2007
(PARI) A000161(n)=#sum2sqr(n) \\ See A133388 for sum2sqr(). - M. F. Hasler, May 13 2018
(Haskell)
a000161 n =
sum $ map (a010052 . (n -)) $ takeWhile (<= n `div` 2) a000290_list
a000161_list = map a000161 [0..]
-- Reinhard Zumkeller, Aug 16 2011
(Python)
from math import prod
from sympy import factorint
def A000161(n):
f = factorint(n)
return int(not any(e&1 for e in f.values())) + (((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1) if n else 1 # Chai Wah Wu, Sep 08 2022
CROSSREFS
Equivalent sequences for other numbers of squares: A010052 (1), A000164 (3), A002635 (4), A000174 (5).
KEYWORD
nonn,core,easy,nice
AUTHOR
STATUS
approved
A022544 Numbers that are not the sum of 2 squares. +10
59
3, 6, 7, 11, 12, 14, 15, 19, 21, 22, 23, 24, 27, 28, 30, 31, 33, 35, 38, 39, 42, 43, 44, 46, 47, 48, 51, 54, 55, 56, 57, 59, 60, 62, 63, 66, 67, 69, 70, 71, 75, 76, 77, 78, 79, 83, 84, 86, 87, 88, 91, 92, 93, 94, 95, 96, 99, 102, 103, 105, 107, 108, 110, 111, 112, 114, 115, 118, 119, 120, 123, 124, 126, 127, 129, 131, 132, 133, 134, 135, 138, 139, 140, 141, 142, 143, 147, 150, 151, 152, 154, 155, 156, 158, 159, 161, 163, 165, 166, 167, 168, 171, 172, 174, 175, 176, 177, 179, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 198, 199 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Conjecture: if k is not the sum of 2 squares then sigma(k) == 0 (mod 4) (the converse does not hold, as demonstrated by the entries in A025303). - Benoit Cloitre, May 19 2002
Numbers having some prime factor p == 3 (mod 4) to an odd power. sigma(n) == 0 (mod 4) because of this prime factor. Every k == 3 (mod 4) is a term. First differences are always 1, 2, 3 or 4, each occurring infinitely often. - David W. Wilson, Mar 09 2005
Complement of A000415 in the nonsquare positive integers A000037. - Max Alekseyev, Jan 21 2010
Integers with an equal number of 4k+1 and 4k+3 divisors. - Ant King, Oct 05 2010
A000161(a(n)) = 0; A070176(a(n)) > 0; A046712 is a subsequence. - Reinhard Zumkeller, Feb 04 2012, Aug 16 2011
There are arbitrarily long runs of consecutive terms. Record runs start at 3, 6, 21, 75, ... (A260157). - Ivan Neretin, Nov 09 2015
From Klaus Purath, Sep 04 2023: (Start)
There are no squares in this sequence.
There are also no numbers of the form n^2 + 1 (A002522) or n^2 + 4 (A087475).
Every term a(n) raised to an odd power belongs to the sequence just as every product of an odd number of terms. This is also true for all integer sequences represented by the indefinite binary quadratic forms a(n)*x^2 - y^2. These sequences also do not contain squares. (End)
REFERENCES
Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 98-104.
LINKS
Steven R. Finch, Landau-Ramanujan Constant [Broken link]
Steven R. Finch, Landau-Ramanujan Constant [From the Wayback machine]
FORMULA
Limit_{n->oo} a(n)/n = 1.
MATHEMATICA
Select[Range[199], Length[PowersRepresentations[ #, 2, 2]] == 0 &] (* Ant King, Oct 05 2010 *)
Select[Range[200], SquaresR[2, #]==0&] (* Harvey P. Dale, Apr 21 2012 *)
PROG
(PARI) for(n=0, 200, if(sum(i=0, n, sum(j=0, i, if(i^2+j^2-n, 0, 1)))==0, print1((n), ", ")))
(PARI) is(n)=if(n%4==3, return(1)); my(f=factor(n)); for(i=1, #f~, if(f[i, 1]%4==3 && f[i, 2]%2, return(1))); 0 \\ Charles R Greathouse IV, Sep 01 2015
(Haskell)
import Data.List (elemIndices)
a022544 n = a022544_list !! (n-1)
a022544_list = elemIndices 0 a000161_list
-- Reinhard Zumkeller, Aug 16 2011
(Magma) [n: n in [0..160] | NormEquation(1, n) eq false]; // Vincenzo Librandi, Jan 15 2017
(Python)
def aupto(lim):
squares = [k*k for k in range(int(lim**.5)+2) if k*k <= lim]
sum2sqs = set(a+b for i, a in enumerate(squares) for b in squares[i:])
return sorted(set(range(lim+1)) - sum2sqs)
print(aupto(199)) # Michael S. Branicky, Mar 06 2021
(Python)
from itertools import count, islice
from sympy import factorint
def A022544_gen(): # generator of terms
return filter(lambda n:any(p & 3 == 3 and e & 1 for p, e in factorint(n).items()), count(0))
A022544_list = list(islice(A022544_gen(), 30)) # Chai Wah Wu, Jun 28 2022
CROSSREFS
Complement of A001481; subsequence of A111909.
KEYWORD
nonn,nice
AUTHOR
EXTENSIONS
More terms from Benoit Cloitre, May 19 2002
STATUS
approved
A000378 Sums of three squares: numbers of the form x^2 + y^2 + z^2. +10
56
0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
An equivalent definition: numbers of the form x^2 + y^2 + z^2 with x,y,z >= 0.
Bourgain studies "the spatial distribution of the representation of a large integer as a sum of three squares, on the small and critical scale as well as their electrostatic energy. The main results announced give strong evidence to the thesis that the solutions behave randomly. This is in sharp contrast to what happens with sums of two or four or more square." Sums of two nonzero squares are A000404. - Jonathan Vos Post, Apr 03 2012
The multiplicities for a(n) (if 0 <= x <= y <= z) are given as A000164(a(n)), n >= 1. Compare with A005875(a(n)) for integer x, y and z, and order taken into account. - Wolfdieter Lang, Apr 08 2013
a(n)^k is a member of this sequence for any k > 1. - Boris Putievskiy, May 05 2013
The selection rule for the planes with Miller indices (hkl) to undergo X-ray diffraction in a simple cubic lattice is h^2+k^2+l^2 = N where N is a term of this sequence. See A004014 for f.c.c. lattice. - Mohammed Yaseen, Nov 06 2022
REFERENCES
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 37.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.
LINKS
Jean Bourgain, Peter Sarnak and Zeév Rudnick, Local statistics of lattice points on the sphere, arXiv:1204.0134 [math.NT], 2012-2015.
J. W. Cogdell, On sums of three squares, Journal de théorie des nombres de Bordeaux, 15 no. 1 (2003), p. 33-44.
L. E. Dickson, Integers represented by positive ternary quadratic forms, Bull. Amer. Math. Soc. 33 (1927), 63-70. See Theorem I.
P. Pollack, Analytic and Combinatorial Number Theory Course Notes, p. 91. [?Broken link]
P. Pollack, Analytic and Combinatorial Number Theory Course Notes, p. 91.
Eric Weisstein's World of Mathematics, Square Number
FORMULA
Legendre: a nonnegative integer is a sum of three squares iff it is not of the form 4^k m with m == 7 (mod 8).
n^(2k+1) is in the sequence iff n is in the sequence. - Ray Chandler, Feb 03 2009
Complement of A004215; complement of A000302(i)*A004771(j), i,j>=0. - Boris Putievskiy, May 05 2013
a(n) = 6n/5 + O(log n). - Charles R Greathouse IV, Mar 14 2014
EXAMPLE
a(1) = 0 = 0^2 + 0^2 + 0^2. A005875(0) = 1 = A000164(0).
a(9) = 9 = 0^2 + 0^2 + 3^2 = 1^2 + 2^2 + 2^2. A000164(9) = 2. A000164(9) = 30 = 2*3 + 8*3 (counting signs and order). - Wolfdieter Lang, Apr 08 2013
MAPLE
isA000378 := proc(n) # return true or false depending on n being in the list
local x, y ;
for x from 0 do
if 3*x^2 > n then
return false;
end if;
for y from x do
if x^2+2*y^2 > n then
break;
else
if issqr(n-x^2-y^2) then
return true;
end if;
end if;
end do:
end do:
end proc:
A000378 := proc(n) # generate A000378(n)
option remember;
local a;
if n = 1 then
0;
else
for a from procname(n-1)+1 do
if isA000378(a) then
return a;
end if;
end do:
end if;
end proc:
seq(A000378(n), n=1..100) ; # R. J. Mathar, Sep 09 2015
MATHEMATICA
okQ[n_] := If[EvenQ[k = IntegerExponent[n, 2]], m = n/2^k; Mod[m, 8] != 7, True]; Select[Range[0, 100], okQ] (* Jean-François Alcover, Feb 08 2016, adapted from PARI *)
PROG
(PARI) isA000378(n)=my(k=valuation(n, 2)); if(k%2==0, n>>=k; n%8!=7, 1)
(PARI) list(lim)=my(v=List(), k, t); for(x=0, sqrtint(lim\=1), for(y=0, min(sqrtint(lim-x^2), x), k=x^2+y^2; for(z=0, min(sqrtint(lim-k), y), listput(v, k+z^2)))); Set(v) \\ Charles R Greathouse IV, Sep 14 2015
(Python)
def valuation(n, b):
v = 0
while n > 1 and n%b == 0: n //= b; v += 1
return v
def ok(n): return n//4**valuation(n, 4)%8 != 7
print(list(filter(ok, range(84)))) # Michael S. Branicky, Jul 15 2021
(Python)
from itertools import count, islice
def A000378_gen(): # generator of terms
return filter(lambda n:n>>2*(bin(n)[:1:-1].index('1')//2) & 7 < 7, count(1))
A000378_list = list(islice(A000378_gen(), 30)) # Chai Wah Wu, Jun 27 2022
CROSSREFS
Union of A000290, A000404 and A000408 (common elements).
Union of A000290, A000415 and A000419 (disjunct sets).
Complement of A004215.
Cf. A005875 (number of representations if x, y and z are integers).
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Ray Chandler, Sep 05 2004
STATUS
approved
page 1 2 3 4 5 6 7 8 9 10 ... 24

Search completed in 0.122 seconds

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 09:12 EDT 2024. Contains 375511 sequences. (Running on oeis4.)