[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: a000415 -id:a000415
Displaying 1-10 of 16 results found. page 1 2
     Sort: relevance | references | number | modified | created      Format: long | short | data
A001481 Numbers that are the sum of 2 squares.
(Formerly M0968 N0361)
+10
232
0, 1, 2, 4, 5, 8, 9, 10, 13, 16, 17, 18, 20, 25, 26, 29, 32, 34, 36, 37, 40, 41, 45, 49, 50, 52, 53, 58, 61, 64, 65, 68, 72, 73, 74, 80, 81, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 121, 122, 125, 128, 130, 136, 137, 144, 145, 146, 148, 149, 153, 157, 160 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Numbers n such that n = x^2 + y^2 has a solution in nonnegative integers x, y.
Closed under multiplication. - David W. Wilson, Dec 20 2004
Also, numbers whose cubes are the sum of 2 squares. - Artur Jasinski, Nov 21 2006 (Cf. A125110.)
Terms are the squares of smallest radii of circles covering (on a square grid) a number of points equal to the terms of A057961. - Philippe Lallouet (philip.lallouet(AT)wanadoo.fr), Apr 16 2007. [Comment corrected by T. D. Noe, Mar 28 2008]
Numbers with more 4k+1 divisors than 4k+3 divisors. If a(n) is a member of this sequence, then so too is any power of a(n). - Ant King, Oct 05 2010
A000161(a(n)) > 0; A070176(a(n)) = 0. - Reinhard Zumkeller, Feb 04 2012, Aug 16 2011
Numbers that are the norms of Gaussian integers. This sequence has unique factorization; the primitive elements are A055025. - Franklin T. Adams-Watters, Nov 25 2011
These are numbers n such that all of n's odd prime factors congruent to 3 modulo 4 occur to an even exponent (Fermat's two-squares theorem). - Jean-Christophe Hervé, May 01 2013
Let's say that an integer n divides a lattice if there exists a sublattice of index n. Example: 2, 4, 5 divide the square lattice. The present sequence without 0 is the sequence of divisors of the square lattice. Say that n is a "prime divisor" if the index-n sublattice is not contained in any other sublattice except the original lattice itself. Then A055025 (norms of Gaussian primes) gives the "prime divisors" of the square lattice. - Jean-Christophe Hervé, May 01 2013
For any i,j > 0 a(i)*a(j) is a member of this sequence, since (a^2 + b^2)*(c^2 + d^2) = (a*c + b*d)^2 + (a*d - b*c)^2. - Boris Putievskiy, May 05 2013
The sequence is closed under multiplication. Primitive elements are in A055025. The sequence can be split into 3 multiplicatively closed subsequences: {0}, A004431 and A125853. - Jean-Christophe Hervé, Nov 17 2013
Generalizing Jasinski's comment, same as numbers whose odd powers are the sum of 2 squares, by Fermat's two-squares theorem. - Jonathan Sondow, Jan 24 2014
By the 4 squares theorem, every nonnegative integer can be expressed as the sum of two elements of this sequence. - Franklin T. Adams-Watters, Mar 28 2015
There are never more than 3 consecutive terms. Runs of 3 terms start at 0, 8, 16, 72, ... (A082982). - Ivan Neretin, Nov 09 2015
Conjecture: barring the 0+2, 0+4, 0+8, 0+16, ... sequence, the sum of 2 distinct terms in this sequence is never a power of 2. - J. Lowell, Jan 14 2022
All the areas of squares whose vertices have integer coordinates. - Neeme Vaino, Jun 14 2023
Numbers represented by the definite binary quadratic forms x^2 + 2nxy + (n^2+1)y^2 for any integer n. This sequence contains the even powers of any integer. An odd power of a number appears only if the number itself belongs to the sequence. The equation given in the comment by Boris Putievskiy 2013 is Brahmagupta's identity with n = 1. It proves that any set of numbers of the form a^2 + nb^2 is closed under multiplication. - Klaus Purath, Sep 06 2023
REFERENCES
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
L. Euler, (E388) Vollständige Anleitung zur Algebra, Zweiter Theil, reprinted in: Opera Omnia. Teubner, Leipzig, 1911, Series (1), Vol. 1, p. 417.
S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 98-104.
G. H. Hardy, Ramanujan, pp. 60-63.
P. Moree and J. Cazaran, On a claim of Ramanujan in his first letter to Hardy, Expos. Math. 17 (1999), pp. 289-312.
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
Michael Baake, Uwe Grimm, Dieter Joseph and Przemyslaw Repetowicz, Averaged shelling for quasicrystals, arXiv:math/9907156 [math.MG], 1999.
Richard T. Bumby, Sums of four squares, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.
Steven R. Finch, Landau-Ramanujan Constant [broken link]
Steven R. Finch, Landau-Ramanujan Constant [From the Wayback Machine]
Steven R. Finch, On a Generalized Fermat-Wiles Equation [broken link]
Steven R. Finch, On a Generalized Fermat-Wiles Equation [From the Wayback Machine]
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., 15 (1884), 104-122. [Annotated scanned copy of pages 104-107 only]
Leonor Godinho, Nicholas Lindsay, and Silvia Sabatini, On a symplectic generalization of a Hirzebruch problem, arXiv:2403.00949 [math.SG], 2024. See p. 17.
Darij Grinberg, UMN Spring 2019 Math 4281 notes, University of Minnesota, College of Science & Engineering, 2019. [Wayback Machine copy]
Thomas Nickson and Igor Potapov, Broadcasting Automata and Patterns on Z^2, arXiv preprint arXiv:1410.0573 [cs.FL], 2014.
Michael Penn, Sums of Squares, Youtube playlist, 2019, 2020.
Peter Shiu, Counting Sums of Two Squares: The Meissel-Lehmer Method, Mathematics of Computation 47 (1986), 351-360.
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
Eric Weisstein's World of Mathematics, Square Number
Eric Weisstein's World of Mathematics, Generalized Fermat Equation
Eric Weisstein's World of Mathematics, Landau-Ramanujan Constant
Eric Weisstein's World of Mathematics, Gaussian Integer
A. van Wijngaarden, A table of partitions into two squares with an application to rational triangles, Proceedings of the Koninklijke Nederlandse Akademie van Wetenschappen, Series A, 53 (1950), 869-875.
Gang Xiao, Two squares
FORMULA
n = square * 2^{0 or 1} * {product of distinct primes == 1 (mod 4)}.
The number of integers less than N that are sums of two squares is asymptotic to constant*N/sqrt(log(N)), hence lim_{n->infinity} a(n)/n = infinity.
Nonzero terms in expansion of Dirichlet series Product_p (1 - (Kronecker(m, p) + 1)*p^(-s) + Kronecker(m, p)*p^(-2s))^(-1) for m = -1.
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533. - Charles R Greathouse IV, Apr 16 2012
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. - Charles R Greathouse IV, Nov 18 2022
MAPLE
readlib(issqr): for n from 0 to 160 do for k from 0 to floor(sqrt(n)) do if issqr(n-k^2) then printf(`%d, `, n); break fi: od: od:
MATHEMATICA
upTo = 160; With[{max = Ceiling[Sqrt[upTo]]}, Select[Union[Total /@ (Tuples[Range[0, max], {2}]^2)], # <= upTo &]] (* Harvey P. Dale, Apr 22 2011 *)
Select[Range[0, 160], SquaresR[2, #] != 0 &] (* Jean-François Alcover, Jan 04 2013 *)
PROG
(PARI) isA001481(n)=local(x, r); x=0; r=0; while(x<=sqrt(n) && r==0, if(issquare(n-x^2), r=1); x++); r \\ Michael B. Porter, Oct 31 2009
(PARI) is(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return(0))); 1 \\ Charles R Greathouse IV, Aug 24 2012
(PARI) B=bnfinit('z^2+1, 1);
is(n)=#bnfisintnorm(B, n) \\ Ralf Stephan, Oct 18 2013, edited by M. F. Hasler, Nov 21 2017
(PARI) list(lim)=my(v=List(), t); for(m=0, sqrtint(lim\=1), t=m^2; for(n=0, min(sqrtint(lim-t), m), listput(v, t+n^2))); Set(v) \\ Charles R Greathouse IV, Jan 05 2016
(PARI) is_A001481(n)=!for(i=2-bittest(n, 0), #n=factor(n)~, bittest(n[1, i], 1)&&bittest(n[2, i], 0)&&return) \\ M. F. Hasler, Nov 20 2017
(Haskell)
a001481 n = a001481_list !! (n-1)
a001481_list = [x | x <- [0..], a000161 x > 0]
-- Reinhard Zumkeller, Feb 14 2012, Aug 16 2011
(Magma) [n: n in [0..160] | NormEquation(1, n) eq true]; // Arkadiusz Wesolowski, May 11 2016
(Python)
from itertools import count, islice
from sympy import factorint
def A001481_gen(): # generator of terms
return filter(lambda n:(lambda m:all(d & 3 != 3 or m[d] & 1 == 0 for d in m))(factorint(n)), count(0))
A001481_list = list(islice(A001481_gen(), 30)) # Chai Wah Wu, Jun 27 2022
CROSSREFS
Disjoint union of A000290 and A000415.
Complement of A022544.
A000404 gives another version. Subsequence of A091072, supersequence of A046711.
Column k=2 of A336820.
KEYWORD
nonn,nice,easy,core
AUTHOR
EXTENSIONS
Deleted an incorrect comment. - N. J. A. Sloane, Oct 03 2023
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
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
A172000 Nonsquare positive integers n such that the fundamental unit of quadratic field Q(sqrt(n)) has norm -1. +10
18
2, 5, 8, 10, 13, 17, 18, 20, 26, 29, 32, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 72, 73, 74, 80, 82, 85, 89, 90, 97, 98, 101, 104, 106, 109, 113, 116, 117, 122, 125, 128, 130, 137, 145, 148, 149, 153, 157, 160, 162, 164, 170, 173, 180, 181, 185, 193, 197, 200 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Complement of A087643 in the nonsquare integers A000037.
Subsequence of A000415, their set difference form A172001.
Contains A003814 as a subsequence, their squarefree terms coincide and form A003654.
It seems that this sequence also gives the values of n such that the equation x^2 - n*y^2 = n has integer solutions. - Colin Barker, Aug 20 2013
LINKS
FORMULA
A positive integer n is in this sequence iff its squarefree core A007913(n) belongs to A003654.
MATHEMATICA
cr = {}; Do[If[IntegerQ[Sqrt[n]], , kk = NumberFieldFundamentalUnits[Sqrt[n]]; d1 = kk[[1]][[2]][[1]]; d2 = kk[[1]][[1]] kk[[1]][[2]][[2]]; d3 = Expand[(d1 + d2) (d1 - d2)]; If[d3 == -1, AppendTo[cr, n]]], {n, 2, 1000}]; cr (* Artur Jasinski, Oct 10 2011 *)
PROG
(PARI) { for(n=1, 1000, if(issquare(n), next); if( norm(bnfinit(x^2-n).fu[1])==-1, print1(n, ", ")) ) }
KEYWORD
nonn
AUTHOR
Max Alekseyev, Jan 21 2010
EXTENSIONS
Edited by Max Alekseyev, Mar 09 2010
STATUS
approved
A000419 Numbers that are the sum of 3 but no fewer nonzero squares. +10
11
3, 6, 11, 12, 14, 19, 21, 22, 24, 27, 30, 33, 35, 38, 42, 43, 44, 46, 48, 51, 54, 56, 57, 59, 62, 66, 67, 69, 70, 75, 76, 77, 78, 83, 84, 86, 88, 91, 93, 94, 96, 99, 102, 105, 107, 108, 110, 114, 115, 118, 120, 123, 126, 129, 131, 132, 133, 134, 138, 139, 140, 141, 142 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
A002828(a(n)) = 3; A025427(a(n)) > 0. - Reinhard Zumkeller, Feb 26 2015
REFERENCES
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.
LINKS
Eric Weisstein's World of Mathematics, Square Number.
FORMULA
Legendre: a nonnegative integer is a sum of three (or fewer) squares iff it is not of the form 4^k m with m == 7 (mod 8).
MATHEMATICA
Select[Range[150], SquaresR[3, #]>0&&SquaresR[2, #]==0&] (* Harvey P. Dale, Nov 01 2011 *)
PROG
(Haskell)
a000419 n = a000419_list !! (n-1)
a000419_list = filter ((== 3) . a002828) [1..]
-- Reinhard Zumkeller, Feb 26 2015
(PARI) is(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return( n/4^valuation(n, 4)%8 !=7 ))); 0 \\ Charles R Greathouse IV, Feb 07 2017
(Python)
def aupto(lim):
squares = [k*k for k in range(1, int(lim**.5)+2) if k*k <= lim]
sum2sqs = set(a+b for i, a in enumerate(squares) for b in squares[i:])
sum3sqs = set(a+b for a in sum2sqs for b in squares)
return sorted(set(range(lim+1)) & (sum3sqs - sum2sqs - set(squares)))
print(aupto(142)) # Michael S. Branicky, Mar 06 2021
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Arlin Anderson (starship1(AT)gmail.com)
STATUS
approved
A131574 Numbers n that are the product of two distinct odd primes and x^2 + y^2 = n has integer solutions. +10
9
65, 85, 145, 185, 205, 221, 265, 305, 365, 377, 445, 481, 485, 493, 505, 533, 545, 565, 629, 685, 689, 697, 745, 785, 793, 865, 901, 905, 949, 965, 985, 1037, 1073, 1145, 1157, 1165, 1189, 1205, 1241, 1261, 1285, 1313, 1345, 1385, 1405, 1417, 1465, 1469 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
The two primes are of the form 4*k + 1.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000 (first 1000 terms from Colin Barker)
EXAMPLE
65 is in the sequence because x^2 + y^2 = 65 = 5*13 has solutions (x,y) = (1,8), (4,7), (7,4) and (8,1).
PROG
(PARI)
dop(d, nmax) = {
my(L=List(), v=vector(d, m, 1)~, f);
for(n=1, nmax,
f=factorint(n);
if(#f~==d && f[1, 1]>2 && f[, 2]==v && f[, 1]%4==v, listput(L, n))
);
Vec(L)
}
dop(2, 3000) \\ Colin Barker, Nov 15 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Colin Barker, Aug 28 2007, corrected Aug 29 2007
STATUS
approved
A363763 a(n) is the least k such that there are exactly n distinct numbers j that can be expressed as the sum of two squares with k^2 < j < (k+1)^2, or -1 if such a k does not exist. +10
8
0, 1, 2, 4, 5, 7, 8, 10, 13, 12, 15, 17, 19, 23, 21, 24, 25, 28, 32, 31, 34, 37, 39, 44, 41, 43, 45, 50, 51, 48, 57, 55, 56, 59, 64, 63, 68, 69, 74, 77, 78, 75, 72, 80, 88, 84, -1, 94, 89, 96, 93, 99, 97, 102, 108, -1, 106, 111, 110, 113, 117, 120, -1, 123, 133, 127, 130, 137, 142, 138, 139, -1, 135 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Index of first occurrence of n in A077773 if there is any, otherwise -1. - Rainer Rosenthal, Jul 07 2023
LINKS
Rainer Rosenthal, Illustrating a(5) = 7.
FORMULA
If a(n) != -1, then a(n) >= n/2. - Chai Wah Wu, Jun 22 2023
a(n) < (n+1)^2/2. - Jon E. Schoenfield and Chai Wah Wu, Jun 24-26 2023
EXAMPLE
From Rainer Rosenthal, Jul 09 2023: (Start)
a(5) = 7, since A077773(7) = 5 and A077773(n) != 5 for n < 7.
a(46) = -1, since a(46) < ((46+1)^2)/2 < 1105 and A077773(k) != 46 for all k < 1105.
See illustrations in the links section. (End)
PROG
(PARI) \\ a4018(n) after Michael Somos
a4018(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)));
a363763 (upto) = {for (n=0, upto, my(kfound=-1); for (k=0, (n+1)^2\2+1, my(kp=k^2+1, km=(k+1)^2-1, m=0); for (j=kp, km, if (a4018(j), m++); if (m>n, break)); if (m==n, kfound=k; break)); print1 (kfound, ", "); )};
a363763(75)
(Python)
from sympy import factorint
def A363763(n):
for k in range(n>>1, ((n+1)**2<<1)+1):
c = 0
for m in range(k**2+1, (k+1)**2):
if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
c += 1
if c>n:
break
if c==n:
return k
return -1 # Chai Wah Wu, Jun 20-26 2023
CROSSREFS
A363762 gives the positions of terms = -1.
Identical with A363761 up to a(11459) = 33864, but increasingly different afterwards, i.e., a(11460) = 34451, whereas A363761(11460) = -1.
KEYWORD
sign
AUTHOR
Hugo Pfoertner, Jun 20 2023
STATUS
approved
A134422 Square numbers which are sums of 2 distinct nonzero squares. +10
6
25, 100, 169, 225, 289, 400, 625, 676, 841, 900, 1156, 1225, 1369, 1521, 1600, 1681, 2025, 2500, 2601, 2704, 2809, 3025, 3364, 3600, 3721, 4225, 4624, 4900, 5329, 5476, 5625, 6084, 6400, 6724, 7225, 7569, 7921, 8100, 8281, 9025, 9409, 10000, 10201 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
FORMULA
a(n) = A009003(n)^2.
EXAMPLE
25 = 5^2 = 4^2 + 3^2, and so 25 is in the sequence.
100 = 10^2 = 8^2 + 6^2, and so 100 is in the sequence.
169 = 13^2 = 12^2 + 5^2, and so 169 is in the sequence.
MATHEMATICA
c = {}; Do[Do[k = a^2 + b^2; If[IntegerQ[Sqrt[k]], AppendTo[c, k]], {a, 1, b - 1}], {b, 200}]; Union[c] (* Artur Jasinski *)
Select[Range[100]^2, Length[PowersRepresentations[#, 2, 2]] > 1 &] (* Alonso del Arte, Feb 11 2014 *)
PROG
(PARI) select(n->for(k=1, sqrtint(n\2), if(issquare(n-k^2), return(n>k^2))); 0, vector(100, i, i^2)) \\ Charles R Greathouse IV, Jul 02 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Artur Jasinski, Oct 25 2007
STATUS
approved
A180416 Number of positive integers below 10^n, excluding perfect squares, which have a representation as a sum of 2 positive squares. +10
6
3, 33, 298, 2649, 23711, 215341, 1982296, 18447847, 173197435, 1637524156, 15570196516, 148735628858, 1426303768587, 13722207893214, 132387231596281, 1280309591127436 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Numbers that can be represented as a sum of three or more positive squares but not as a sum of two positive squares (e.g., 3=1^2+1^2+1^2 or 6=1^2+1^2+2^2) are not counted. Numbers that can be represented as a sum of two positive squares and alternatively as a sum of three or more positive squares are counted (e.g., 18 = 9+9 = 1+1+16, 26, 41, ...).
LINKS
FORMULA
a(n) = |{ 0<k<10^n : k in {A000415} }|.
a(n) = |{ 0<k<10^n : k in ({A000404} \ {A000290}) }|.
a(n) = A002283(n) - A049416(n) - A167615(n) - A180425(n).
MAPLE
isA000415 := proc(n) local x , y2; if issqr(n) then false; else for x from 1 do y2 := n-x^2 ; if y2 < x^2 then return false; elif issqr(y2) then return true; end if; end do ; end if; end proc:
A180416 := proc(n) a := 0 ; for k from 2 to 10^n-1 do if isA000415(k) then a := a+1 ; end if; end do: a ; end proc:
for n from 1 do print(A180416(n)) ; end do; # R. J. Mathar, Jan 20 2011
MATHEMATICA
a[n_] := a[n] = Module[{k, xMax = Floor[Sqrt[10^n - 1]]}, Table[k = x^2 + y^2; If[IntegerQ[Sqrt[k]], Nothing, k], {x, 1, xMax}, {y, x, Floor[ Sqrt[10^n - 1 - x^2]]}] // Flatten // Union // Length];
Table[Print[n, " ", a[n]]; a[n], {n, 1, 8}] (* Jean-François Alcover, Oct 31 2020 *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Martin Renner, Jan 19 2011
EXTENSIONS
a(6)-a(8) from Alois P. Heinz, Jan 20 2011
a(9)-a(10) from Donovan Johnson, Feb 04 2011
a(10) corrected and a(11)-a(16) from Hiroaki Yamanouchi, Jul 13 2014
STATUS
approved
page 1 2

Search completed in 0.021 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.)