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-4 of 4 results.

A004432 Numbers that are the sum of 3 distinct nonzero squares.

Original entry on oeis.org

14, 21, 26, 29, 30, 35, 38, 41, 42, 45, 46, 49, 50, 53, 54, 56, 59, 61, 62, 65, 66, 69, 70, 74, 75, 77, 78, 81, 83, 84, 86, 89, 90, 91, 93, 94, 98, 101, 104, 105, 106, 107, 109, 110, 113, 114, 115, 116, 117, 118, 120, 121, 122, 125, 126, 129, 131, 133
Offset: 1

Views

Author

Keywords

Comments

Numbers that can be written as a(n) = x^2 + y^2 + z^2 with 0 < x < y < z.
This is a subsequence (equal to the range) of A024803. As a set, it is the union of A025339 and A024804, subsequences of numbers having exactly one, resp. more than one, such representations. - M. F. Hasler, Jan 25 2013
Conjecture: a number n is a sum of 3 squares, but not a sum of 3 distinct nonzero squares (i.e., is in A004432 but not A000408), if and only if it is of the form 4^j*s, where j >= 0 and s in {1, 2, 3, 5, 6, 9, 10, 11, 13, 17, 18, 19, 22, 25, 27, 33, 34, 37, 43, 51, 57, 58, 67, 73, 82, 85, 97, 99, 102, 123, 130, 163, 177, 187, 193, 267, 627, 697}. - Jeffrey Shallit, Jan 15 2017
4*a(n) gives the sums of 3 distinct nonzero even squares. - Wesley Ivan Hurt, Apr 05 2021

Examples

			14 = 1^2 + 2^2 + 3^2;
62 = 1^2 + 5^2 + 6^2.
		

Crossrefs

Programs

  • Haskell
    a004432 n = a004432_list !! (n-1)
    a004432_list = filter (p 3 $ tail a000290_list) [1..] where
       p k (q:qs) m = k == 0 && m == 0 ||
                      q <= m && k >= 0 && (p (k - 1) qs (m - q) || p k qs m)
    -- Reinhard Zumkeller, Apr 22 2013
  • Mathematica
    f[upto_]:=Module[{max=Floor[Sqrt[upto]]},Select[Union[Total/@ (Subsets[ Range[ max],{3}]^2)],#<=upto&]]; f[150]  (* Harvey P. Dale, Mar 24 2011 *)
  • PARI
    is_A004432(n)=for(x=1,sqrtint(n\3),for(y=x+1,sqrtint((n-1-x^2)\2),issquare(n-x^2-y^2)&return(1)))  \\ M. F. Hasler, Feb 02 2013
    

Formula

A004432 = { x^2 + y^2 + z^2; 0 < x < y < z }.
n is in A004432 <=> A025442(n) > 0. - M. F. Hasler, Feb 03 2013

A025442 Number of partitions of n into 3 distinct nonzero squares.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Column k=3 of A341040.

Programs

  • Maple
    b:= proc(n,i,t) option remember; `if`(n=0, `if`(t=0,1,0),
          `if`(i<1 or t<1, 0, `if`(i=1, 0, b(n,i-1,t))+
          `if`(i^2>n, 0, b(n-i^2,i-1,t-1))))
        end:
    a:= n-> b(n, isqrt(n), 3):
    seq(a(n), n=0..120);  # Alois P. Heinz, Feb 07 2013
  • Mathematica
    b[n_, i_, t_] := b[n, i, t] = If[n==0, If[t==0, 1, 0], If[i<1 || t<1, 0, If[i==1, 0, b[n, i-1, t]] + If[i^2 > n, 0, b[n-i^2, i-1, t-1]]]]; a[n_] := b[n, Sqrt[n] // Floor, 3]; Table[a[n], {n, 0, 120}] (* Jean-François Alcover, Oct 10 2015, after Alois P. Heinz *)
  • PARI
    A025442(n)={sum(x=1,sqrtint(n\3),sum(y=x+1,sqrtint((n-1-x^2)\2),issquare(n-x^2-y^2)))} \\ - M. F. Hasler, Feb 03 2013

Formula

a(n)>0 <=> n is in A004432. - M. F. Hasler, Feb 03 2013
a(n) = [x^n y^3] Product_{k>=1} (1 + y*x^(k^2)). - Ilya Gutkovskiy, Apr 22 2019

A001974 Numbers that are the sum of 3 distinct squares, i.e., numbers of the form x^2 + y^2 + z^2 with 0 <= x < y < z.

Original entry on oeis.org

5, 10, 13, 14, 17, 20, 21, 25, 26, 29, 30, 34, 35, 37, 38, 40, 41, 42, 45, 46, 49, 50, 52, 53, 54, 56, 58, 59, 61, 62, 65, 66, 68, 69, 70, 73, 74, 75, 77, 78, 80, 81, 82, 83, 84, 85, 86, 89, 90, 91, 93, 94, 97, 98, 100, 101, 104, 105, 106, 107, 109, 110, 113
Offset: 1

Views

Author

Keywords

Comments

Also: Numbers which are the sum of two or three distinct nonzero squares. - M. F. Hasler, Feb 03 2013
According to Halter-Koch (below), a number n is a sum of 3 squares, but not a sum of 3 distinct squares (i.e., is in A001974 but not A000408), if and only if it is of the form 4^j*s, where j >= 0 and s in {1, 2, 3, 6, 9, 11, 18, 19, 22, 27, 33, 43, 51, 57, 67, 99, 102, 123, 163, 177, 187, 267, 627, ?}, where ? denotes at most one unknown number that, if it exists, is > 5*10^10. - Jeffrey Shallit, Jan 15 2017

Examples

			5 = 0^2 + 1^2 + 2^2.
		

Crossrefs

Cf. A004436 (complement).

Programs

  • Mathematica
    r[n_] := Reduce[0 <= x < y < z && x^2 + y^2 + z^2 == n, {x, y, z}, Integers]; ok[n_] := r[n] =!= False; Select[ Range[113], ok] (* Jean-François Alcover, Dec 05 2011 *)
  • Python
    from itertools import combinations
    def aupto(lim):
      s = filter(lambda x: x <= lim, (i*i for i in range(int(lim**.5)+2)))
      s3 = set(filter(lambda x: x<=lim, (sum(c) for c in combinations(s, 3))))
      return sorted(s3)
    print(aupto(113)) # Michael S. Branicky, May 10 2021

A025339 Numbers that are the sum of 3 distinct nonzero squares in exactly one way.

Original entry on oeis.org

14, 21, 26, 29, 30, 35, 38, 41, 42, 45, 46, 49, 50, 53, 54, 56, 59, 61, 65, 66, 70, 75, 78, 81, 83, 84, 91, 93, 104, 106, 107, 109, 113, 114, 115, 116, 118, 120, 121, 133, 137, 139, 140, 142, 145, 147, 152, 153, 157, 162, 164, 168, 169, 171, 178, 180, 184, 190, 196, 198, 200
Offset: 1

Views

Author

Keywords

Comments

Numbers n such that there is a unique triple (i,j,k) with 0 < i < j < k and n = i^2 + j^2 + k^2.
By removing the terms that have a factor of 4 we obtain A096017. - T. D. Noe, Jun 15 2004

Examples

			14 is a term since 14 = 1^2+2^2+3^2.
38 is a term since 38 = 2^2+3^2+5^2 (note that 38 is also 1^2+1^2+6^2, but that is not a contradiction since here i=j).
		

Crossrefs

A subsequence of A004432.
A274226 has a somewhat similar definition but is actually a different sequence.

Programs

  • Maple
    N:= 10^4; # to get all terms <= N
    S:= Vector(N):
    for a from 1 to floor(sqrt(N/3)) do
      for b from a+1 to floor(sqrt((N-a^2)/2)) do
        c:= [$(b+1) .. floor(sqrt(N-a^2-b^2))]:
        v:= map(t -> a^2 + b^2 + t^2, c):
        S[v]:= map(`+`,S[v],1)
    od od:
    select(t -> S[t]=1, [$1..N]); # Robert Israel, Jan 03 2016
  • Mathematica
    Select[Range[200], (pr = PowersRepresentations[#, 3, 2]; Length[Select[pr, Union[#] == # && #[[1]] > 0&]] == 1)&] (* Jean-François Alcover, Feb 27 2019 *)
Showing 1-4 of 4 results.