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.

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

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This sequence lists the values of A000404(n)/2 when A000404(n) is an even number. In other words, sequence lists integers n that are the average of two nonzero squares. - Altug Alkan, May 26 2016

Crossrefs

Cf. A000404, subsequence of A001481, A004435 (complement), A025435, A004431.
Union of A000290 and A004431 excluding 0.

Programs

  • Haskell
    a001983 n = a001983_list !! (n-1)
    a001983_list = [x | x <- [0..], a025435 x > 0]
    -- Reinhard Zumkeller, Dec 20 2013
    
  • Mathematica
    upto=200;max=Floor[Sqrt[upto]];s=Total/@((Subsets[Range[0,max], {2}])^2);Union[Select[s,#<=upto&]]  (* Harvey P. Dale, Apr 01 2011 *)
    selQ[n_] := Select[ PowersRepresentations[n, 2, 2], 0 <= #[[1]] < #[[2]] &] != {}; Select[Range[200], selQ] (* Jean-François Alcover, Oct 03 2013 *)
  • PARI
    list(lim)=my(v=List()); for(x=0,sqrtint(lim\4), for(y=x+1, sqrtint(lim\1-x^2), listput(v, x^2+y^2))); Set(v) \\ Charles R Greathouse IV, Feb 07 2017

Formula

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

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

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

A178210 Numbers that are not the sum of squares of distinct composite numbers.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76
Offset: 1

Views

Author

Keywords

Crossrefs

Showing 1-4 of 4 results.