[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 1-10 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
A020756 Numbers that are the sum of two triangular numbers. +0
20
0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 15, 16, 18, 20, 21, 22, 24, 25, 27, 28, 29, 30, 31, 34, 36, 37, 38, 39, 42, 43, 45, 46, 48, 49, 51, 55, 56, 57, 58, 60, 61, 64, 65, 66, 67, 69, 70, 72, 73, 76, 78, 79, 81, 83, 84, 87, 88, 90, 91, 92, 93, 94, 97, 99, 100, 101, 102, 105, 106, 108 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
The possible sums of a square and a promic, i.e., x^2+n(n+1), e.g., 3^2 + 2*3 = 9 + 6 = 15 is present. - Jon Perry, May 28 2003
A052343(a(n)) > 0; union of A118139 and A119345. - Reinhard Zumkeller, May 15 2006
Also union of A051533 and A000217. - Ant King, Nov 29 2010
LINKS
John A. Ewell, On Sums of Triangular Numbers and Sums of Squares, The American Mathematical Monthly, 99:8 (October 1992), pp. 752-757.
T. Khovanova, K. Knop, and A. Radul, Baron Munchhausen's Sequence, J. Int. Seq. 13 (2010) # 10.8.7.
L. K. Mork, Keith Sullivan, Trenton Vogt, and Darin J. Ulness, A group theoretical approach to the partitioning of integers: Application to triangular numbers, squares, and centered polygonal numbers, Australasian J. Comb. (2021) Vol. 80, No. 3, 305-321.
FORMULA
Numbers n such that 4n+1 is the sum of two squares, i.e. such that 4n+1 is in A001481. Hence n is a member if and only if 4n+1 = odd square * product of distinct primes of form 4k+1. (Fred Helenius and others, Dec 18 2004)
Equivalently, we may say that a positive integer n can be partitioned into a sum of two triangular numbers if and only if every 4 k + 3 prime factor in the canonical form of 4 n + 1 occurs with an even exponent. - Ant King, Nov 29 2010
Also, the values of n for which 8n+2 can be partitioned into a sum of two squares of natural numbers. - Ant King, Nov 29 2010
Closed under the operation f(x, y) = 4*x*y + x + y.
MATHEMATICA
q[k_] := If[! Head[Reduce[m (m + 1) + n (n + 1) == 2 k && 0 <= m && 0 <= n, {m, n}, Integers]] === Symbol, k, {}]; DeleteCases[Table[q[i], {i, 0, 108}], {}] (* Ant King, Nov 29 2010 *)
Take[Union[Total/@Tuples[Accumulate[Range[0, 20]], 2]], 80] (* Harvey P. Dale, May 02 2012 *)
PROG
(PARI) v=vector(200); vc=0; for (x=0, 10, for (y=0, 10, v[vc++ ]=x^2+y*(y+1))); v=vecsort(v); v
(PARI) is(n)=my(f=factor(4*n+1)); for(i=1, #f~, if(f[i, 1]%4==3 && f[i, 2]%2, return(0))); 1 \\ Charles R Greathouse IV, Jul 05 2013
(Haskell)
a020756 n = a020756_list !! (n-1)
a020756_list = filter ((> 0) . a052343) [0..]
-- Reinhard Zumkeller, Jul 25 2014
CROSSREFS
Complement of A020757.
Cf. A051533 (sums of two positive triangular numbers), A001481 (sums of two squares), A002378, A000217.
Cf. A052343.
KEYWORD
nonn,nice
AUTHOR
EXTENSIONS
Entry revised by N. J. A. Sloane, Dec 20 2004
STATUS
approved
A002144 Pythagorean primes: primes of the form 4*k + 1.
(Formerly M3823 N1566)
+0
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
A256435 First differences of sums of two squares. +0
1
1, 1, 2, 1, 3, 1, 1, 3, 3, 1, 1, 2, 5, 1, 3, 3, 2, 2, 1, 3, 1, 4, 4, 1, 2, 1, 5, 3, 3, 1, 3, 4, 1, 1, 6, 1, 1, 3, 4, 1, 7, 1, 2, 1, 3, 2, 3, 4, 3, 1, 4, 1, 3, 3, 2, 6, 1, 7, 1, 1, 2, 1, 4, 4, 3, 2, 2, 5, 1, 3, 5, 2, 1, 4, 8, 1, 2, 1, 3, 2, 3, 3, 4, 6, 3, 4, 1, 3, 3, 1, 1, 7, 1, 2, 1, 5, 6, 1, 3, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Sequence includes arbitrarily large values as well as infinitely many 1s.
LINKS
R. P. Bambah and S. Chowla, On numbers which can be expressed as a sum of two squares. Proc. Nat. Inst. Sci. India (1947), 101-103.
Rainer Dietmann, Christian Elsholtz, Alexander Kalmynin, Sergei Konyagin, James Maynard, Longer Gaps Between Values of Binary Quadratic Forms, International Mathematics Research Notices, Volume 2023, Issue 12, June 2023, Pages 10313-10349.
P. Erdös, Some problems and results in elementary number theory, Publ. Math. Debrecen (1951), 103-109.
Ian Richards, On the gaps between numbers which are sums of two squares, Adv. in Math. (1982), 1-2.
FORMULA
a(n) = A001481(n+1) - A001481(n).
MAPLE
b:= proc(n) option remember; local j, k;
for k from 1+`if`(n=1, -1, b(n-1)) do
for j from 0 to isqrt(iquo(k, 2)) do
if issqr(k-j^2) then return k fi
od od
end:
a:= n-> b(n+1)-b(n):
seq(a(n), n=1..100); # Alois P. Heinz, Mar 29 2015
MATHEMATICA
Select[Range[0, 1000], SquaresR[2, #] != 0&] // Differences (* Jean-François Alcover, Mar 28 2017 *)
PROG
(PARI) issum2sq(n) = my(fm=factor(n)); for(k=1, matsize(fm)[1], if(fm[k, 1]%4==3&&fm[k, 2]%2==1, return(0))); 1
al(n) = my(r=vector(n), j=0, k=0, last=0); while(k<n, if(issum2sq(j++), r[k++]=j-last; last=j)); r
(PARI) show(lim)=my(v=vectorsmall(lim\=1), u=List(), t=1); for(m=1, sqrtint(lim), for(n=1, sqrtint(lim-m^2), v[m^2+n^2]=1)); for(i=2, #v, if(v[i], listput(u, i-t); t=i)); Vec(u) \\ Charles R Greathouse IV, Mar 31 2015
CROSSREFS
Cf. A001481 (sums of 2 squares), A005408 (differences between squares).
KEYWORD
nonn
AUTHOR
STATUS
approved
A237526 a(n) = number of unit squares in the first quadrant of a disk of radius sqrt(n) centered at the origin of a square lattice. +0
3
0, 0, 1, 1, 1, 3, 3, 3, 4, 4, 6, 6, 6, 8, 8, 8, 8, 10, 11, 11, 13, 13, 13, 13, 13, 15, 17, 17, 17, 19, 19, 19, 20, 20, 22, 22, 22, 24, 24, 24, 26, 28, 28, 28, 28, 30, 30, 30, 30, 30, 33, 33, 35, 37, 37, 37, 37, 37, 39, 39, 39, 41, 41, 41, 41, 45, 45, 45, 47, 47 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
LINKS
FORMULA
a(A000404(n)) = A232499(n).
a(n) = Sum_{k=1..floor(sqrt(n))} floor(sqrt(n-k^2)). - M. F. Hasler, Feb 09 2014
G.f.: (theta_3(x) - 1)^2/(4*(1 - x)), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 17 2018
For n > 1, Pi*(n+2-sqrt(8n)) < a(n) < Pi*n. (This is trivial and can probably be improved by methods like Euler-Maclaurin and perhaps even a modification of the Dirichlet hyperbola method.) - Charles R Greathouse IV, Jul 17 2024
MATHEMATICA
a[n_]:=Sum[Floor[Sqrt[n-k^2]], {k, Floor[Sqrt[n]]}]; Array[a, 70, 0] (* Stefano Spezia, Jul 19 2024 *)
PROG
(PARI) A237526(n)=sum(k=1, sqrtint(n), sqrtint(n-k^2)) \\ M. F. Hasler, Feb 09 2014
(Python)
from math import isqrt
def A237526(n): return sum(isqrt(n-k**2) for k in range(1, isqrt(n)+1)) # Chai Wah Wu, Jul 18 2024
CROSSREFS
Partial sums of A063725.
KEYWORD
nonn
AUTHOR
L. Edson Jeffery, Feb 09 2014
STATUS
approved
A353387 a(n) is the least squared distance between 2 points of an n X n grid not occurring between two points of an (n-1) X (n-1) grid. +0
2
1, 4, 9, 16, 26, 36, 49, 64, 81, 101, 121, 144, 173, 196, 226, 256, 293, 324, 361, 401, 441, 484, 529, 576, 626, 677, 729, 784, 842, 904, 961, 1024, 1089, 1172, 1226, 1296, 1373, 1444, 1522, 1601, 1697, 1764, 1849, 1936, 2026, 2116, 2209, 2304, 2401, 2504, 2602, 2708 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,2
LINKS
PROG
(PARI) a353387(nmax)={my(v=vectorsmall(2*nmax^2)); for(n=1, nmax, my(dfirst=0);
for(k=0, n, my(s=n^2+k^2); if(!v[s], if(!dfirst, print1(s, ", "); dfirst=1); v[s]++)))};
a353387(52)
CROSSREFS
First column of A353386.
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Apr 16 2022
STATUS
approved
A018786 Numbers that are the sum of two 4th powers in more than one way. +0
10
635318657, 3262811042, 8657437697, 10165098512, 51460811217, 52204976672, 68899596497, 86409838577, 138519003152, 160961094577, 162641576192, 264287694402, 397074160625, 701252453457, 823372979472, 835279626752 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Since 4th powers are squares, this is a subsequence of A024508, the analog for squares. Sequence A001235 is the analog for third powers (taxicab numbers). Sequence A255351 lists max {a,b,c,d} where a^4 + b^4 = c^4 + d^4 = a(n), while A255352 lists the whole quadruples (a,b,c,d). - M. F. Hasler, Feb 21 2015
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, D1.
LINKS
Mia Muessig, Table of n, a(n) for n = 1..30000 (terms 1..111 from Vincenzo Librandi, terms 112..4359 from Sean A. Irvine)
J. Leech, Some solutions of Diophantine equations, Proc. Camb. Phil. Soc., 53 (1957), 778-780.
Eric Weisstein's World of Mathematics, Biquadratic Number.
Eric Weisstein's World of Mathematics, Diophantine Equation.
FORMULA
A weak lower bound: a(n) >> n^2. - Charles R Greathouse IV, Jul 12 2024
EXAMPLE
a(1) = 59^4 + 158^4 = 133^4 + 134^4.
a(2) = 7^4 + 239^4 = 157^4 + 227^4. Note the remarkable coincidence that here all of {7, 239, 157, 227} are primes. The next larger solution with this property is 17472238301875630082 = 62047^4 + 40351^4 = 59693^4 + 46747^4. - M. F. Hasler, Feb 21 2015
MATHEMATICA
Select[ Split[ Sort[ Flatten[ Table[x^4 + y^4, {x, 1, 1000}, {y, 1, x}]]]], Length[#] > 1 & ][[All, 1]] (* Jean-François Alcover, Jul 26 2011 *)
PROG
(PARI) n=4; L=[]; for(b=1, 999, for(a=1, b, t=a^n+b^n; for(c=a+1, sqrtn(t\2, n), ispower(t-c^n, n)||next; print1(t", ")))) \\ M. F. Hasler, Feb 21 2015
(PARI) list(lim)=my(v=List()); for(a=134, sqrtnint(lim, 4)-1, my(a4=a^4); for(b=sqrtnint((4*a^2 + 6*a + 4)*a, 4)+1, min(sqrtnint(lim-a4, 4), a), my(t=a4+b^4); for(c=a+1, sqrtnint(lim, 4), if(ispower(t-c^4, 4), listput(v, t); break)))); Set(v) \\ Charles R Greathouse IV, Jul 12 2024
CROSSREFS
Subsequence of A003336 (and hence A004831) and A024508 (and hence A001481).
KEYWORD
nonn
AUTHOR
STATUS
approved
A227158 Second-order term in the asymptotic expansion of B(x), the count of numbers up to x which are the sum of two squares. +0
8
5, 8, 1, 9, 4, 8, 6, 5, 9, 3, 1, 7, 2, 9, 0, 7, 9, 7, 9, 2, 8, 1, 4, 9, 8, 8, 4, 5, 0, 2, 3, 6, 7, 5, 5, 9, 3, 0, 4, 8, 3, 2, 8, 7, 3, 0, 7, 1, 7, 7, 2, 5, 2, 1, 8, 2, 3, 4, 2, 1, 2, 9, 9, 2, 6, 5, 2, 5, 1, 2, 3, 1, 5, 5, 5, 9, 5, 0, 3, 4, 6, 1, 4, 3, 0, 1, 2, 3, 6, 1, 3, 1, 4, 9, 2, 4, 1, 3, 4, 9, 6 (list; constant; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
K = A064533, the Landau-Ramanujan constant, is the first-order term. This constant is c = lim_{x->oo} (B(x)*sqrt(log x)/(K*x) - 1)*log x. [Corrected by Alessandro Languasco, Sep 14 2022]
130000 digits are available, see link to web page. - Alessandro Languasco, Mar 27 2024
REFERENCES
Steven R. Finch, Mathematical Constants, Cambridge University Press, 2003, Section 2.3 Landau-Ramanujan constants, p. 99.
LINKS
Alexandru Ciolan, Alessandro Languasco and Pieter Moree, Landau and Ramanujan approximations for divisor sums and coefficients of cusp forms, section 10, 47500 digits are obtained, Journal of Mathematical Analysis and Applications, 2022; see also preprint on arXiv, arXiv:2109.03288 [math.NT], 2021.
Alessandro Languasco, Programs and numerical results, providing 130000 digits. [Note: information ancillary to above link.]
Alessandro Languasco and Pieter Moree, Euler constants from primes in arithmetic progression, arXiv:2406.16547 [math.NT], 2024. See p. 9.
David Hare, Landau-Ramanujan Constant, second order obtained about 5000 digits, 1996.
Daniel Shanks, The second-order term in the asymptotic expansion of B(x), Mathematics of Computation 18 (1964), pp. 75-86.
Eric Weisstein's World of Mathematics, Landau-Ramanujan Constant.
EXAMPLE
0.58194865931729079777136487517474826173838317235153574360562...
MATHEMATICA
digits = 101; m0 = 5; dm = 5; beta[x_] := 1/4^x*(Zeta[x, 1/4] - Zeta[x, 3/4]); L = Pi^(3/2)/Gamma[3/4]^2*2^(1/2)/2; Clear[f]; f[m_] := f[m] = 1/2*(1 - Log[Pi*E^EulerGamma/(2*L)]) - 1/4*NSum[ Zeta'[2^k]/Zeta[2^k] - beta'[2^k]/beta[2^k] + Log[2]/(2^(2^k) - 1), {k, 1, m}, WorkingPrecision -> digits + 10] ; f[m0]; f[m = m0 + dm]; While[RealDigits[f[m], 10, digits] != RealDigits[f[m - dm], 10, digits], m = m + dm]; RealDigits[f[m], 10, digits] // First (* Jean-François Alcover, May 27 2014 *)
PROG
(PARI) L(s)=sumalt(k=0, (-1)^k/(2*k+1)^s)
LL(s)=L'(s)/L(s)
ZZ(s)=zeta'(s)/zeta(s)
sm(x)=my(s); forprime(q=2, x, if(q%4==3, s+=log(q)/(q^8-1))); s+1/49/x^7+log(x)/7/x^7
1/2+log(2)/4-Euler/4-LL(1)/4-ZZ(2)/4+LL(2)/4-log(2)/12-ZZ(4)/4+LL(4)/4-log(2)/60+sm(1e5)/2
CROSSREFS
KEYWORD
nonn,cons
AUTHOR
EXTENSIONS
Corrected and extended by Jean-François Alcover, Mar 19 2014 and again May 27 2014
STATUS
approved
A155562 Intersection of A001481 and A002479: N = a^2 + b^2 = c^2 + 2d^2 for some integers a,b,c,d. +0
2
0, 1, 2, 4, 8, 9, 16, 17, 18, 25, 32, 34, 36, 41, 49, 50, 64, 68, 72, 73, 81, 82, 89, 97, 98, 100, 113, 121, 128, 136, 137, 144, 146, 153, 162, 164, 169, 178, 193, 194, 196, 200, 225, 226, 233, 241, 242, 256, 257, 272, 274, 281, 288, 289, 292, 306, 313, 324, 328 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Contains A155561 as a subsequence (obtained by restricting a,b,c,d to be nonzero). Also contains A000290 (squares) and A001105 (twice the squares) as subsequence.
From Warut Roonguthai, Oct 13 2009: (Start)
N is also of the form x^2 - 2y^2.
N = (p^2-q^2-2*r*s)^2+(r^2-s^2-2*p*q)^2
= (p^2+q^2-r^2-s^2)^2+2*(p*r-p*s-q*r-q*s)^2
= (p^2+q^2+r^2+s^2)^2-2*(p*r+p*s+q*r-q*s)^2
for some nonnegative integers p, q, r, s. (End)
Numbers k such that in the prime factorization of k, all odd primes that occur with an odd exponent are congruent to 1 (mod 8). - Robert Israel, Jun 24 2024
LINKS
Andrew D. Ionaşcu, Intersecting semi-disks and the synergy of three quadratic forms, An. Şt. Univ. Ovidius Constantą, (2019) Vol. 27, Issue 2, 5-13.
PROG
(PARI) isA155562(n, /* use optional 2nd arg to get other analogous sequences */c=[2, 1]) = { for(i=1, #c, for(b=0, sqrtint(n\c[i]), issquare(n-c[i]*b^2) & next(2)); return); 1}
for( n=1, 500, isA155562(n) & print1(n", "))
(Python)
from itertools import count, islice
from sympy import factorint
def A155562_gen(): # generator of terms
return filter(lambda n:all((p & 3 != 3 and p & 7 < 5) or e & 1 == 0 for p, e in factorint(n).items()), count(0))
A155562_list = list(islice(A155562_gen(), 30)) # Chai Wah Wu, Jun 27 2022
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Jan 24 2009
STATUS
approved
A346522 a(n) is the smallest number such that there are precisely n squares between a(n) and 2*a(n) inclusive. +0
3
1, 8, 25, 61, 98, 162, 221, 288, 392, 481, 613, 722, 841, 1013, 1152, 1352, 1513, 1741, 1922, 2113, 2381, 2592, 2888, 3121, 3362, 3698, 3961, 4325, 4608, 5000, 5305, 5618, 6050, 6385, 6845, 7200, 7565, 8065, 8450, 8978, 9385, 9800, 10368, 10805, 11401, 11858 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Smallest index where A105224 takes the value n.
The sequence is increasing, as the number of squares between k and 2k is at most one less than the number of squares between k+1 and 2*(k+1).
Either 2*a(n) - 1 or 2*a(n) is a perfect square. a(n)-1 is not a perfect square. - David A. Corneth, Jul 22 2021 [Edited by Elvar Wang Atlason, Jul 22 2021]
If a(n) is even, then 2*a(n)-1 is not a square by considering mod 4. Then 2*a(n) must be square, so a(n) is itself twice a square. Next, if a(n) is odd, then 2*a(n) is not a square. So 2*a(n)-1 is a square, and then a(n) is a sum of consecutive squares. This also shows that a(n) is expressible as a sum of two squares, and so is a subsequence of A001481. - Elvar Wang Atlason, Jul 25 2021
LINKS
FORMULA
a(n) = ceiling(((floor(2*n-1+sqrt(2)*(n-1)))^2)/2). - Elvar Wang Atlason, Mar 24 2024
EXAMPLE
For n = 3, a(3) = 25 as there are 3 squares between 25 and 50, namely 5^2, 6^2 and 7^2. No number k smaller than 25 has 3 squares between k and 2k inclusive.
MATHEMATICA
a[n_]:=(k=1; While[Floor@Sqrt[2k]-Floor@Sqrt[k-1]!=n, k++]; k); Array[a, 30] (* Giorgos Kalogeropoulos, Jul 22 2021 *)
PROG
(Python)
k = 1
n = 1
while n<100:
if math.isqrt(2*k)-math.isqrt(k-1) == n:
print(k)
n = n+1
k = k+1
(Python)
from itertools import count
from math import isqrt
def A346522(n): return next(filter(lambda k:isqrt(k<<1)-isqrt(k-1)==n, (m**2+1>>1 for m in count(1)))) # Chai Wah Wu, Oct 19 2022
(PARI) a(n) = my(k=1); while (sqrtint(2*k) - sqrtint(k-1) != n, k++); k; \\ Michel Marcus, Jul 22 2021
(PARI) a(n) = n--; (ceil(sqrt(2)*(n/(sqrt(2)-1)))^2 + 1)\2 + (n==0) \\ David A. Corneth, Jul 22 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
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)
+0
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
page 1 2 3 4 5 6 7 8 9 10 ... 24

Search completed in 0.120 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:16 EDT 2024. Contains 375511 sequences. (Running on oeis4.)