A025427 Number of partitions of n into 3 nonzero squares.
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
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).
Links
- R. J. Mathar and R. Zumkeller, Table of n, a(n) for n = 0..10000, first 5592 terms from R. J. Mathar
- Index to sequences related to sums of squares and cubes.
Crossrefs
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
Comments