cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A000408 Numbers that are the sum of three nonzero squares.

Original entry on oeis.org

3, 6, 9, 11, 12, 14, 17, 18, 19, 21, 22, 24, 26, 27, 29, 30, 33, 34, 35, 36, 38, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 84, 86, 88, 89, 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 104
Offset: 1

Views

Author

Keywords

Comments

a(n) !== 7 (mod 8). - Boris Putievskiy, May 05 2013
A025427(a(n)) > 0. - Reinhard Zumkeller, Feb 26 2015
According to Halter-Koch (below), a number n is a sum of 3 squares, but not a sum of 3 nonzero squares (i.e., is in A000378 but not A000408), if and only if it is of the form 4^j*s, where j >= 0 and s in {1,2,5,10,13,25,37,58,85,130,?}, where ? denotes at most one unknown number that, if it exists, is > 5*10^10. - Jeffrey Shallit, Jan 15 2017

References

  • L. E. Dickson, History of the Theory of Numbers, vol. II: Diophantine Analysis, Dover, 2005, p. 267.
  • Savin Réalis, Answer to question 25 ("Toute puissance entière de 3 est une somme de trois carrés premiers avec 3"), Mathesis 1 (1881), pp. 87-88. (See also p. 73 where the question is posed.)

Crossrefs

Programs

  • Haskell
    a000408 n = a000408_list !! (n-1)
    a000408_list = filter ((> 0) . a025427) [1..]
    -- Reinhard Zumkeller, Feb 26 2015
    
  • Maple
    N:= 1000: # to get all terms <= N
    S:= series((JacobiTheta3(0,q)-1)^3,q,1001):
    select(t -> coeff(S,q,t)>0, [$1..N]); # Robert Israel, Jan 14 2016
  • Mathematica
    f[n_] := Flatten[Position[Take[Rest[CoefficientList[Sum[x^(i^2), {i, n}]^3, x]], n^2], ?Positive]];f[11] (* _Ray Chandler, Dec 06 2006 *)
    pr[n_] := Select[ PowersRepresentations[n, 3, 2], FreeQ[#, 0] &]; Select[ Range[104], pr[#] != {} &] (* Jean-François Alcover, Apr 04 2013 *)
    max = 1000; s = (EllipticTheta[3, 0, q] - 1)^3 + O[q]^(max+1); Select[ Range[max], SeriesCoefficient[s, {q, 0, #}] > 0 &] (* Jean-François Alcover, Feb 01 2016, after Robert Israel *)
  • PARI
    is(n)=for(x=sqrtint((n-1)\3)+1,sqrtint(n-2), for(y=1,sqrtint(n-x^2-1), if(issquare(n-x^2-y^2), return(1)))); 0 \\ Charles R Greathouse IV, Apr 04 2013
    
  • PARI
    is(n)= my(a, b) ; a=1 ; while(a^2+1Altug Alkan, Jan 18 2016
    
  • 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)
    print(aupto(104)) # Michael S. Branicky, Mar 06 2021

Formula

a(n) = 6n/5 + O(log n). - Charles R Greathouse IV, Mar 14 2014; error term improved Jul 05 2024

A025427 Number of partitions of n into 3 nonzero squares.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 2, 0, 1, 1, 0, 0, 2, 1, 1, 1, 0, 2, 0, 0, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 0, 1, 3, 0, 1, 2, 0, 2, 0, 1, 2, 0, 0, 1, 3, 1, 1, 2, 1, 0, 1, 1, 2, 2, 1, 2, 1, 0, 0, 3, 1, 2, 1, 0, 3, 0, 1, 3, 2, 1, 0, 1, 2, 0, 1, 1, 2, 3, 0, 3, 2, 0, 1, 2, 1, 2
Offset: 0

Views

Author

Keywords

Comments

The non-vanishing values a(n) give the multiplicities for the numbers n appearing in A000408. See also A024795 where these numbers n are listed a(n) times. For the primitive case see A223730 and A223731. - Wolfdieter Lang, Apr 03 2013

Examples

			a(27) = 2 because  1^2 + 1^2 + 5^2 = 27  = 3^2 + 3^2 + 3^2. The second representation is not primitive (gcd(3,3,3) = 3 not 1).
		

Crossrefs

Cf. A000408, A024795, A223730 (multiplicities for the primitive case). - Wolfdieter Lang, Apr 03 2013
Column k=3 of A243148.

Programs

  • Haskell
    a025427 n = sum $ map f zs where
       f x = sum $ map (a010052 . (n - x -)) $
                       takeWhile (<= div (n - x) 2) $ dropWhile (< x) zs
       zs = takeWhile (< n) $ tail a000290_list
    -- Reinhard Zumkeller, Feb 26 2015
    
  • Maple
    A025427 := proc(n)
        local a,x,y,zsq ;
        a := 0 ;
        for x from 1 do
            if 3*x^2 > n then
                return a;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                end if;
                zsq := n-x^2-y^2 ;
                if issqr(zsq) then
                    a := a+1 ;
                end if;
            end do:
        end do:
    end proc: # R. J. Mathar, Sep 15 2015
    # second Maple program:
    b:= proc(n, i, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
          `if`(i<1 or t<1, 0, b(n, i-1, t)+
          `if`(i^2>n, 0, b(n-i^2, i, t-1))))
        end:
    a:= n-> b(n, isqrt(n), 3):
    seq(a(n), n=0..107);  # Alois P. Heinz, Jun 14 2025
  • Mathematica
    Count[PowersRepresentations[#, 3, 2], pr_ /; (Times @@ pr) > 0]& /@ Range[0, 120] (* Jean-François Alcover, Jan 30 2018 *)
  • PARI
    a(n)=if(n<3, return(0)); sum(i=sqrtint((n-1)\3)+1,sqrtint(n-2), my(t=n-i^2); sum(j=sqrtint((t-1)\2)+1,min(sqrtint(t-1),i), issquare(t-j^2))) \\ Charles R Greathouse IV, Aug 05 2024

Formula

a(A004214(n)) = 0; a(A000408(n)) > 0; a(A025414(n)) = n and a(m) != n for m < A025414(n). - Reinhard Zumkeller, Feb 26 2015
a(4n) = a(n). This is because if a number divisible by 4 is the sum of three squares, each of those squares must be even. - Robert Israel, Mar 09 2016
a(n) = Sum_{k=1..floor(n/3)} Sum_{i=k..floor((n-k)/2)} A010052(i) * A010052(k) * A010052(n-i-k). - Wesley Ivan Hurt, Apr 19 2019
a(n) = [x^n y^3] Product_{k>=1} 1/(1 - y*x^(k^2)). - Ilya Gutkovskiy, Apr 19 2019

A307219 a(n) is the number of partitions of (prime(n)^2 + 2)/3 into 3 squares.

Original entry on oeis.org

1, 1, 2, 2, 1, 2, 2, 5, 6, 2, 6, 3, 6, 5, 14, 8, 6, 5, 6, 15, 10, 6, 14, 24, 14, 6, 12, 12, 6, 16, 19, 18, 18, 36, 18, 10, 16, 20, 20, 12, 28, 18, 8, 24, 38, 27, 40, 20, 17, 30, 52, 18, 22, 26, 29, 21, 42, 31, 26, 26, 18, 44, 38, 40, 46, 26, 30, 44, 38, 36, 52, 28, 27, 38, 103, 22, 38, 78
Offset: 3

Views

Author

Marius A. Burtea, Mar 29 2019

Keywords

Comments

If p >= 5 is a prime number it can be written as p = 6m-1 or p = 6m+1. The identities ((6m-1)^2 + 2)/3 = (2m)^2 + (2m)^2 + (2m-1)^2 and ((6m+1)^2 + 2)/3 = (2m)^2 + (2m)^2 + (2m+1)^2 show that the number (p^2 + 2)/3 can be written as a sum of 3 squares of integers in at least one way.

Examples

			For n = 3, p = prime(3) = 5, (5^2+2)/3 = 9 = 2^2 + 2^2 + 1^2, so a(3) = 1.
For n = 9, p = prime(9) = 23, (23^2+2)/3 = 177 = 13^2 + 2^2 + 2^2 = 8^2 + 8^2 + 7^2, so a(9) = 2.
For n = 17, p = prime(17) = 59, (59^2+2)/3 = 1161 = 34^2 + 2^2 + 1^2 = 33^2 + 6^2 + 6^2 = 24^2 + 11^2 + 4^2 = 31^2 + 14^2 + 2^2 = 31^2 + 10^2 + 10^2 = 30^2 + 15^2 + 6^2 = 29^2 + 16^2 + 8^2 = 28^2 + 19^2 + 4^2 = 28^2 + 16^2 + 11^2 = 26^2 + 22^2 + 1^2 = 26^2 + 17^2 + 14^2 = 24^2 + 24^2 + 3^2 = 24^2 + 21^2 + 12^2 = 20^2 + 20^2 + 19^2, so a(17) = 14.
		

References

  • Ion Cucurezeanu, Pătrate și cuburi perfecte de numere întregi (Squares and perfect cubes of integer numbers), Ed. Gil., Zalău, 2007, ch. 1, p. 21, pr. 166.
  • Laurențiu Panaitopol, Dinu Șerbănescu, Number theory and combinatorial problems for juniors, Ed. Gil, Zalău, (2003), ch. 1, p. 5, pr. 4. (in Romanian).

Crossrefs

Programs

  • Magma
    [#RestrictedPartitions(Floor((p*p+2)/3),3,{d*d:d in [1..p]}): p in PrimesInInterval(5,500) ];
    
  • PARI
    a(n)={k=(prime(n+2)^2+2)/3;sum(a=1, k, sum(b=1, a, sum(c=1, b, a^2+b^2+c^2==k)));} \\ Jinyuan Wang, Mar 30 2019
Showing 1-3 of 3 results.