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

A025426 Number of partitions of n into 2 nonzero squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

For records see A007511, A048610, A016032. - R. J. Mathar, Feb 26 2008

Crossrefs

Cf. A000161 (2 nonnegative squares), A063725 (order matters), A025427 (3 nonzero squares).
Cf. A172151, A004526. - Reinhard Zumkeller, Jan 26 2010
Column k=2 of A243148.

Programs

  • Haskell
    a025426 n = sum $ map (a010052 . (n -)) $
                          takeWhile (<= n `div` 2) $ tail a000290_list
    a025426_list = map a025426 [0..]
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    A025426 := proc(n)
        local a,x;
        a := 0 ;
        for x from 1 do
            if 2*x^2 > n then
                return a;
            end if;
            if issqr(n-x^2) then
                a := a+1 ;
            end if;
        end do:
    end proc: # R. J. Mathar, Sep 15 2015
  • Mathematica
    m[n_] := m[n] = SquaresR[2, n]/4; a[0] = 0; a[n_] := If[ EvenQ[ m[n] ], m[n]/2, (m[n] - (-1)^IntegerExponent[n, 2])/2]; Table[ a[n], {n, 0, 107}] (* Jean-François Alcover, Jan 31 2012, after Max Alekseyev *)
    nmax = 107; sq = Range[Sqrt[nmax]]^2;
    Table[Length[Select[IntegerPartitions[n, All, sq], Length[#] == 2 &]], {n, 0, nmax}] (* Robert Price, Aug 17 2020 *)
  • PARI
    a(n)={my(v=valuation(n,2),f=factor(n>>v),t=1);for(i=1,#f[,1],if(f[i,1]%4==1,t*=f[i,2]+1,if(f[i,2]%2,return(0))));if(t%2,t-(-1)^v,t)/2;} \\ Charles R Greathouse IV, Jan 31 2012
    
  • Python
    from math import prod
    from sympy import factorint
    def A025426(n): return ((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in factorint(n).items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1 # Chai Wah Wu, Jul 07 2022

Formula

Let m = A004018(n)/4. If m is even then a(n) = m/2, otherwise a(n) = (m - (-1)^A007814(n))/2. - Max Alekseyev, Mar 09 2009, Mar 14 2009
a(A018825(n)) = 0; a(A000404(n)) > 0; a(A025284(n)) = 1; a(A007692(n)) > 1. - Reinhard Zumkeller, Aug 16 2011
a(A000578(n)) = A084888(n). - Reinhard Zumkeller, Jul 18 2012
a(n) = Sum_{i=1..floor(n/2)} A010052(i) * A010052(n-i). - Wesley Ivan Hurt, Apr 19 2019
a(n) = [x^n y^2] Product_{k>=1} 1/(1 - y*x^(k^2)). - Ilya Gutkovskiy, Apr 19 2019
Conjecture: Sum_{k=1..n} a(k) ~ n*Pi/8. - Vaclav Kotesovec, Dec 28 2023

A048610 Smallest number that is the sum of two positive squares in >= n ways.

Original entry on oeis.org

2, 50, 325, 1105, 5525, 5525, 27625, 27625, 71825, 138125, 160225, 160225, 801125, 801125, 801125, 801125, 2082925, 2082925, 4005625, 4005625, 5928325, 5928325, 5928325, 5928325, 29641625, 29641625, 29641625, 29641625, 29641625, 29641625
Offset: 1

Views

Author

Keywords

Examples

			2 = 1^2 + 1^2; 50 = 1^2 + 7^2 = 5^2 + 5^2; 325 = 1^2 + 18^2 = 6^2 + 17^2 = 10^2 + 15^2.
		

References

  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 50, p. 19, Ellipses, Paris 2008.
  • J. Meeus, Problem 1375, J. Rec. Math., 18 (No. 1, 1985), p. 70.
  • Problem 590, J. Rec. Math., 11 (No. 2, 1978), p. 137.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    (* Assuming a(n) multiple of 1105, from 1105 on, to speed up computation *) twoSquaresR[n_] := twoSquaresR[n] = With[{r = Reduce[0 < x <= y && n == x^2 + y^2, {x, y}, Integers]}, If[r === False, 0, Length[{x, y} /. {ToRules[r]}]]]; a[n_] := a[n] = For[an = a[n - 1], True, an = If[an < 1105, an + 1, an + 1105], If[ twoSquaresR[an] >= n, Return[an]]];a[1] = 2; Table[ Print[a[n]]; a[n], {n, 1, 30}] (* Jean-François Alcover, Jun 22 2012 *)
    nn = 10^6; t2 = Table[0, {nn}]; n2 = Floor[Sqrt[nn]]; Do[r = a^2 + b^2; If[r <= nn, t2[[r]]++], {a, n2}, {b, a, n2}]; t = {}; n = 1; While[a = Position[t2, ?(# >= n &), 1, 1]; a != {}, AppendTo[t, a[[1, 1]]]; n++]; t (* _T. D. Noe, Jun 22 2012 *)

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
Showing 1-3 of 3 results.