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-10 of 11 results. Next

A003995 Sum of (any number of) distinct squares: of form r^2 + s^2 + t^2 + ... with 0 <= r < s < t < ...

Original entry on oeis.org

0, 1, 4, 5, 9, 10, 13, 14, 16, 17, 20, 21, 25, 26, 29, 30, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 97
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A001983, A033461, A008935. Complement of A001422.

Programs

  • Haskell
    a003995 n = a003995_list !! (n-1)
    a003995_list = filter (p a000290_list) [0..]
       where p (q:qs) m = m == 0 || q <= m && (p qs (m - q) || p qs m)
    -- Reinhard Zumkeller, Apr 22 2013
  • Mathematica
    lim = 10; s = {0}; Do[s = Union[s, s + n^2], {n, lim}]; Select[s, 0 <= # <= lim^2 &] (* T. D. Noe, Jul 10 2012 *)
  • PARI
    a(n)=if(n<1,0,n=a(n-1); until(polcoeff(prod(k=1,sqrt(n),1+x^k^2), n), n++); n)
    

Formula

Exponents in expansion of (1+x)*(1+x^4)*(1+x^9)*(1+x^16)*(1+x^25)*(1+x^36)*(1+x^49)*(1+x^64)*(1+x^81)*(1+x^100)*(1+x^121)*(1+x^144)*...
For n > 98, a(n) = n + 30. - Charles R Greathouse IV, Sep 02 2011 (This implies a(n+2) = 2*a(n+1)-a(n) for n > 98.)

A025435 Number of partitions of n into 2 distinct squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(A004435(n)) = 0; a(A001983(n)) > 0. - Reinhard Zumkeller, Dec 20 2013

Examples

			G.f. = x + x^4 + x^5 + x^9 + x^10 + x^13 + x^16 + x^17 + x^20 + 2*x^25 + ...
		

Crossrefs

Programs

  • Haskell
    a025435 0 = 0
    a025435 n = a010052 n + sum
       (map (a010052 . (n -)) $ takeWhile (< n `div` 2) $ tail a000290_list)
    -- Reinhard Zumkeller, Dec 20 2013
    
  • Maple
    A025435 := proc(n)
        local i, j, ans;
        ans := 0;
        for i from 0 to n do
            for j from i+1 to n do
                if i^2+j^2=n then
                    ans := ans+1
                fi
            end do
        end do;
        ans ;
    end proc: # R. J. Mathar, Aug 04 2018
  • Mathematica
    a[ n_] := If[ n < 0, 0, Sum[ Boole[ n == i^2 + j^2], {i, Sqrt[n]}, {j, 0, i - 1}]]; (* Michael Somos, Jun 24 2015 *)
    a[ n_] := Length@ PowersRepresentations[ n, 2, 2] - Boole @ IntegerQ @ Sqrt[2 n]; (* Michael Somos, Jun 24 2015 *)
    a[ n_] := SeriesCoefficient[ With[ {f = (EllipticTheta[ 3, 0, x] + 1)/2, g = (EllipticTheta[ 3, 0, x^2] + 1)/2}, f f - g] / 2, {x, 0, n}]; (* Michael Somos, Jun 24 2015 *)
  • PARI
    {a(n) = if( n<0, 0, sum(i=1, sqrtint(n), sum(j=0, i-1, n == i^2 + j^2)))}; /* Michael Somos, Jun 24 2015 */
    
  • PARI
    A025435(n)=sum(k=sqrtint((n-1+!n)\2)+1, sqrtint(n), issquare(n-k^2))-issquare(n/2) \\ or A000161(n)-issquare(n/2). - M. F. Hasler, Aug 05 2018
    
  • Python
    from math import prod
    from sympy import factorint
    def A025435(n):
        f = factorint(n)
        return int(not any(e&1 for p,e in f.items() if p>2))*(1-((f.get(2,0)&1)<<1)) + (((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1) if n else 0 # Chai Wah Wu, Sep 08 2022

Formula

a(n) = A000161(n) - A010052(2*n). - M. F. Hasler, Aug 05 2018
a(n) = Sum_{i=1..n} c(i) * c(2*n-i), where c is the square characteristic (A010052). - Wesley Ivan Hurt, Nov 26 2020

A052199 Numbers that are expressible as the sum of 2 distinct positive squares in more ways than any smaller number.

Original entry on oeis.org

1, 5, 65, 325, 1105, 5525, 27625, 71825, 138125, 160225, 801125, 2082925, 4005625, 5928325, 29641625, 77068225, 148208125, 243061325, 1215306625, 3159797225, 6076533125, 12882250225, 53716552825, 64411251125, 167469252925, 322056255625, 785817263725
Offset: 1

Views

Author

Jud McCranie, Jan 28 2000

Keywords

Examples

			65 = 1^2 + 8^2 = 4^2 + 7^2, the smallest expressible in two ways, so 65 is a term.
		

References

  • Donald S. McDonald, Postings to sci.math newsgroup, Feb 21, 1995 and Dec 04, 1995.

Crossrefs

Cf. A001983, A007511, A048610, A071383. Subsequence of A054994. Where records occur in A025441; corresponding number of ways is A060306.

Programs

  • PARI
    c_old=-1;for(n=1,10000,c=0;for(i=1,floor(sqrt(n)),for(j=1,i-1,if(i^2+j^2==n,c+=1)));if(c>c_old,print1(n,", ");c_old=c)) \\ Derek Orr, Mar 15 2019

Extensions

More terms from Randall L Rathbun, Jan 18 2002
Edited by Ray Chandler, Jan 12 2012

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

A001944 Numbers that are the sum of 4 distinct squares: of form w^2 + x^2 + y^2 + z^2 with 0 <= w < x < y < z.

Original entry on oeis.org

14, 21, 26, 29, 30, 35, 38, 39, 41, 42, 45, 46, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 63, 65, 66, 69, 70, 71, 74, 75, 77, 78, 79, 81, 83, 84, 85, 86, 87, 89, 90, 91, 93, 94, 95, 98, 99, 101, 102, 104, 105, 106, 107, 109, 110, 111, 113, 114, 115, 116, 117
Offset: 1

Views

Author

Keywords

Examples

			14 = 0^2 + 1^2 + 2^2 + 3^2.
		

Crossrefs

Programs

  • Mathematica
    nn = 20; Select[Union[Flatten[Table[a^2 + b^2 + c^2 + d^2, {a, 0, nn}, {b, a + 1, nn}, {c, b + 1, nn}, {d, c + 1, nn}]]], # <= nn^2 &] (* T. D. Noe, Aug 17 2012 *)

A004435 Positive integers that are not the sum of 2 distinct square integers.

Original entry on oeis.org

2, 3, 6, 7, 8, 11, 12, 14, 15, 18, 19, 21, 22, 23, 24, 27, 28, 30, 31, 32, 33, 35, 38, 39, 42, 43, 44, 46, 47, 48, 51, 54, 55, 56, 57, 59, 60, 62, 63, 66, 67, 69, 70, 71, 72, 75, 76, 77, 78, 79, 83, 84, 86, 87, 88, 91
Offset: 1

Views

Author

Keywords

Comments

A025435(a(n)) = 0. - Reinhard Zumkeller, Dec 20 2013

Crossrefs

Cf. A001983 (complement).

Programs

  • Haskell
    a004435 n = a004435_list !! (n-1)
    a004435_list = [x | x <- [1..], a025435 x == 0]
    -- Reinhard Zumkeller, Dec 20 2013
  • Mathematica
    Select[Range[100], Reduce[0 <= i < j && # == i^2 + j^2, {i, j}, Integers] === False &] (* Jean-François Alcover, Aug 01 2018 *)

A025302 Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way.

Original entry on oeis.org

5, 10, 13, 17, 20, 25, 26, 29, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 68, 73, 74, 80, 82, 89, 90, 97, 100, 101, 104, 106, 109, 113, 116, 117, 122, 136, 137, 146, 148, 149, 153, 157, 160, 164, 169, 173, 178, 180, 181, 193, 194, 197, 200, 202, 208, 212, 218, 225, 226, 229
Offset: 1

Views

Author

Keywords

Comments

From Fermat's two squares theorem, every prime of the form 4k + 1 is a term (A002144). - Bernard Schott, Apr 15 2022

Crossrefs

Cf. A002144 (subsequence), A009000, A009003, A024507, A025441, A004431.
Cf. Subsequence of A001983; A004435.

Programs

  • Haskell
    a025302 n = a025302_list !! (n-1)
    a025302_list = [x | x <- [1..], a025441 x == 1]
    
  • Mathematica
    nn = 229; t = Table[0, {nn}]; lim = Floor[Sqrt[nn - 1]]; Do[num = i^2 + j^2; If[num <= nn, t[[num]]++], {i, lim}, {j, i - 1}]; Flatten[Position[t, 1]] (* T. D. Noe, Apr 07 2011 *)
    a[1] = 5; a[ n_] := a[n] = Module[ {s = a[n - 1], t = True, j}, While[ t, s++; Do[ If[ i^2 + (j = Floor[Sqrt[s - i^2]])^2 == s && i < j, t = False; Break], {i, Sqrt[s/2]}]]; s]; (* Michael Somos, Jan 20 2019 *)
  • Python
    from collections import Counter
    from itertools import combinations
    def aupto(lim):
      s = filter(lambda x: x <= lim, (i*i for i in range(1, int(lim**.5)+2)))
      s2 = filter(lambda x: x <= lim, (sum(c) for c in combinations(s, 2)))
      s2counts = Counter(s2)
      return sorted(k for k in s2counts if k <= lim and s2counts[k] == 1)
    print(aupto(229)) # Michael S. Branicky, May 10 2021

Formula

A025441(a(n)) = 1. - Reinhard Zumkeller, Dec 20 2013

A132777 Nonsquare numbers which are the sum of 2 distinct squares.

Original entry on oeis.org

5, 10, 13, 17, 20, 26, 29, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 73, 74, 80, 82, 85, 89, 90, 97, 101, 104, 106, 109, 113, 116, 117, 122, 125, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 164
Offset: 1

Views

Author

Rob Hubbard (hubbard.r(AT)gmail.com), Oct 08 2007

Keywords

Comments

This is simply A001983 excluding the square numbers.
The squares of these numbers are also sums of two distinct nonzero squares. Including them gives A004431. - Jean-Christophe Hervé, Nov 11 2013

Examples

			5 = 4 + 1, and 5^2 = 16 + 9 ; 10 = 9 + 1, and 10^2 = 64 + 36. - _Jean-Christophe Hervé_, Nov 11 2013
		

Crossrefs

Programs

  • Mathematica
    selQ[n_] := !IntegerQ[Sqrt[n]] && Select[ PowersRepresentations[n, 2, 2], 0 <= #[[1]] < #[[2]]&] != {};
    Select[Range[1000], selQ] (* Jean-François Alcover, Apr 20 2023 *)

Extensions

Definition corrected by Jean-Christophe Hervé, Nov 11 2013

A114090 Sums of 2 distinct nonnegative cubes.

Original entry on oeis.org

1, 8, 9, 27, 28, 35, 64, 65, 72, 91, 125, 126, 133, 152, 189, 216, 217, 224, 243, 280, 341, 343, 344, 351, 370, 407, 468, 512, 513, 520, 539, 559, 576, 637, 728, 729, 730, 737, 756, 793, 854, 855, 945, 1000, 1001, 1008, 1027, 1064, 1072, 1125, 1216, 1241, 1331
Offset: 1

Views

Author

Franklin T. Adams-Watters, Sep 14 2006

Keywords

Comments

Except for zero, equivalently sums of at most 2 distinct positive cubes.

Crossrefs

Programs

  • Maple
    N:= 2000: # to get all terms <= N
    S:= select(`<=`,{seq(seq(a^3 + b^3, b = 0 .. a-1),a=0..floor(N^(1/3)))},N):
    sort(convert(S,list)); # Robert Israel, May 31 2018
  • Mathematica
    Select[Union@ Flatten[Table[i^3 + j^3, {i, 11}, {j, 0, i-1}]], # <= 11^3 &] (* Giovanni Resta, May 31 2018 *)
    Module[{upto=15},Select[Union[Total/@Subsets[Range[0,upto]^3,{2}]],#<= upto^3&]] (* Harvey P. Dale, Sep 07 2019 *)

A294774 a(n) = 2*n^2 + 2*n + 5.

Original entry on oeis.org

5, 9, 17, 29, 45, 65, 89, 117, 149, 185, 225, 269, 317, 369, 425, 485, 549, 617, 689, 765, 845, 929, 1017, 1109, 1205, 1305, 1409, 1517, 1629, 1745, 1865, 1989, 2117, 2249, 2385, 2525, 2669, 2817, 2969, 3125, 3285, 3449, 3617, 3789, 3965, 4145, 4329, 4517, 4709, 4905
Offset: 0

Views

Author

Bruno Berselli, Nov 08 2017

Keywords

Comments

This is the case k = 9 of 2*n^2 + (1-(-1)^k)*n + (2*k-(-1)^k+1)/4 (similar sequences are listed in Crossrefs section). Note that:
2*( 2*n^2 + (1-(-1)^k)*n + (2*k-(-1)^k+1)/4 ) - k = ( 2*n + (1-(-1)^k)/2 )^2. From this follows an alternative definition for the sequence: Numbers h such that 2*h - 9 is a square. Therefore, if a(n) is a square then its base is a term of A075841.

Crossrefs

1st diagonal of A154631, 3rd diagonal of A055096, 4th diagonal of A070216.
Second column of Mathar's array in A016813 (Comments section).
Subsequence of A001481, A001983, A004766, A020668, A046711 and A057653 (because a(n) = (n+2)^2 + (n-1)^2); A097268 (because it is also a(n) = (n^2+n+3)^2 - (n^2+n+2)^2); A047270; A243182 (for y=1).
Similar sequences (see the first comment): A161532 (k=-14), A181510 (k=-13), A152811 (k=-12), A222182 (k=-11), A271625 (k=-10), A139570 (k=-9), (-1)*A147973 (k=-8), A059993 (k=-7), A268581 (k=-6), A090288 (k=-5), A054000 (k=-4), A142463 or A132209 (k=-3), A056220 (k=-2), A046092 (k=-1), A001105 (k=0), A001844 (k=1), A058331 (k=2), A051890 (k=3), A271624 (k=4), A097080 (k=5), A093328 (k=6), A271649 (k=7), A255843 (k=8), this sequence (k=9).

Programs

  • Maple
    seq(2*n^2 + 2*n + 5, n=0..100); # Robert Israel, Nov 10 2017
  • Mathematica
    Table[2n^2+2n+5,{n,0,50}] (* or *) LinearRecurrence[{3,-3,1},{5,9,17},50] (* Harvey P. Dale, Sep 18 2023 *)
  • PARI
    Vec((5 - 6*x + 5*x^2) / (1 - x)^3 + O(x^50)) \\ Colin Barker, Nov 13 2017

Formula

O.g.f.: (5 - 6*x + 5*x^2)/(1 - x)^3.
E.g.f.: (5 + 4*x + 2*x^2)*exp(x).
a(n) = a(-1-n) = 3*a(n-1) - 3*a(n-2) + a(n-3).
a(n) = 5*A000217(n+1) - 6*A000217(n) + 5*A000217(n-1).
n*a(n) - Sum_{j=0..n-1} a(j) = A002492(n) for n>0.
a(n) = Integral_{x=0..2n+4} |3-x| dx. - Pedro Caceres, Dec 29 2020
Showing 1-10 of 11 results. Next