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-5 of 5 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

A274226 Numbers that have a unique representation as a sum of three nonzero squares, and furthermore in this representation the squares are distinct.

Original entry on oeis.org

14, 21, 26, 29, 30, 35, 42, 45, 46, 49, 50, 53, 56, 61, 65, 70, 78, 84, 91, 93, 104, 106, 109, 115, 116, 120, 133, 140, 142, 145, 157, 168, 169, 180, 184, 190, 196, 200, 202, 205, 212, 224, 235, 244, 253, 260, 265
Offset: 1

Views

Author

Andreas Boe, Jun 14 2016

Keywords

Comments

The numbers in this sequence can be expressed as a sum of 3 positive squares in exactly one way, and those 3 squares are distinct. This is different from A025339.

Examples

			14 is a term because it can be expressed in just one way as a sum of 3 squares (1^2+2^2+3^2) and the 3 squares are different.
38 is not a term, because, even if it can be expressed as a sum of 3 distinct squares in just one way (2^2+3^2+5^2), it can also be expressed as a sum of 3 non-distinct squares (1^2+1^2+6^2). This makes 38 a member of A004432 and A025339.
		

Crossrefs

Cf. A025339, A004432, A274227 (the primes in this sequence).

Programs

  • Mathematica
    rp[n_] := Flatten@ IntegerPartitions[n, {3}, Range[Sqrt@n]^2]; Select[
    Range[265], Length[u = rp[#]] == 3 && Union[u] == Sort[u] &] (* Giovanni Resta, Jun 15 2016 *)

A274227 Primes in A274226.

Original entry on oeis.org

29, 53, 61, 109, 157, 277, 397
Offset: 1

Views

Author

Andreas Boe, Jun 14 2016

Keywords

Comments

If a(8) exists it must be larger than 10^8.
From a proof outline of Wagner, the discriminants of Q(sqrt(-p)) with class number 6 end at -1588, ending this sequence at 397. - Travis Scott, Feb 09 2023

Examples

			29 is a term because 2^2 + 3^2 + 4^2 = 29 is the only representation of 29 as a sum of 3 positive squares, and those squares are distinct.
41 is not a term because, even though it can be represented in just one way as a sum of 3 distinct squares (1^2 + 2^2 + 6^2) it can also be represented as 3^2 + 4^2 + 4^2.
		

Crossrefs

Programs

  • Mathematica
    rp[n_] := Flatten@ IntegerPartitions[n, {3}, Range[Sqrt@n]^2]; Select[
    Range[265] // Prime, Length[u = rp[#]] == 3 && Union[u] == Sort[u] &] (* Giovanni Resta, Jun 16 2016 *)
    Select[Prime@Range@78,Sum[(-1)^Boole@Xor[Mod[t,4]==1,PowerMod[t,(#-1)/2,#]==1],{t,1,#-1,2}]==6&] (* Travis Scott, Feb 09 2023 *)
Showing 1-5 of 5 results.