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 24 results. Next

A000161 Number of partitions of n into 2 squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Number of ways of writing n as a sum of 2 (possibly zero) squares when order does not matter.
Number of similar sublattices of square lattice with index n.
Let Pk = the number of partitions of n into k nonzero squares. Then we have A000161 = P0 + P1 + P2, A002635 = P0 + P1 + P2 + P3 + P4, A010052 = P1, A025426 = P2, A025427 = P3, A025428 = P4. - Charles R Greathouse IV, Mar 08 2010, amended by M. F. Hasler, Jan 25 2013
a(A022544(n))=0; a(A001481(n))>0; a(A125022(n))=1; a(A118882(n))>1. - Reinhard Zumkeller, Aug 16 2011

Examples

			25 = 3^2+4^2 = 5^2, so a(25) = 2.
		

References

  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 339

Crossrefs

Equivalent sequences for other numbers of squares: A010052 (1), A000164 (3), A002635 (4), A000174 (5).

Programs

  • Haskell
    a000161 n =
       sum $ map (a010052 . (n -)) $ takeWhile (<= n `div` 2) a000290_list
    a000161_list = map a000161 [0..]
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    A000161 := proc(n) local i,j,ans; ans := 0; for i from 0 to n do for j from i to n do if i^2+j^2=n then ans := ans+1 fi od od; RETURN(ans); end; [ seq(A000161(i), i=0..50) ];
    A000161 := n -> nops( numtheory[sum2sqr](n) ); # M. F. Hasler, Nov 23 2007
  • Mathematica
    Length[PowersRepresentations[ #,2,2]] &/@Range[0,150] (* Ant King, Oct 05 2010 *)
  • PARI
    a(n)=sum(i=0,n,sum(j=0,i,if(i^2+j^2-n,0,1))) \\ for illustrative purpose
    
  • PARI
    A000161(n)=sum(k=sqrtint((n-1)\2)+1,sqrtint(n),issquare(n-k^2)) \\ Charles R Greathouse IV, Mar 21 2014, improves earlier code by M. F. Hasler, Nov 23 2007
    
  • PARI
    A000161(n)=#sum2sqr(n) \\ See A133388 for sum2sqr(). - M. F. Hasler, May 13 2018
    
  • Python
    from math import prod
    from sympy import factorint
    def A000161(n):
        f = factorint(n)
        return int(not any(e&1 for e in f.values())) + (((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 1 # Chai Wah Wu, Sep 08 2022

Formula

a(n) = card { { a,b } c N | a^2+b^2 = n }. - M. F. Hasler, Nov 23 2007
Let f(n)= the number of divisors of n that are congruent to 1 modulo 4 minus the number of its divisors that are congruent to 3 modulo 4, and define delta(n) to be 1 if n is a perfect square and 0 otherwise. Then a(n)=1/2 (f(n)+delta(n)+delta(1/2 n)). - Ant King, Oct 05 2010

A000164 Number of partitions of n into 3 squares (allowing part zero).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) = number of triples of integers [ i, j, k] such that i >= j >= k >= 0 and n = i^2 + j^2 + k^2. - Michael Somos, Jun 05 2012

Examples

			G.f. = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^8 + 2*x^9 + x^10 + x^11 + x^12 + x^13 + ...
		

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 84.

Crossrefs

Equivalent sequences for other numbers of squares: A000161 (2), A002635 (4), A000174 (5).
Cf. A004215 (positions of zeros), A094942 (positions of ones), A124966 (positions of greater values).

Programs

  • Maple
    A000164 := proc(n)
        local a,x,y,z2,z ;
        a := 0 ;
        for x from 0 do
            if 3*x^2 > n then
                return a;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                end if;
                z2 := n-x^2-y^2 ;
                if issqr(z2) then
                    z := sqrt(z2) ;
                    if z >= y then
                        a := a+1 ;
                    end if;
                end if;
            end do:
        end do:
        a;
    end proc: # R. J. Mathar, Feb 12 2017
  • Mathematica
    Length[PowersRepresentations[ #, 3, 2]] & /@ Range[0, 104]
    e[0,r_,s_,m_]=0;e[n_,r_,s_,m_]:=Length[Select[Divisors[n],Mod[ #,m]==r &]]-Length[Select[Divisors[n],Mod[ #,m]==s &]];alpha[n_]:=5delta[n]+3delta[1/2 n]+4delta[1/3n];beta[n_]:=4e[n,1,3,4]+3e[n,1,7,8]+3e[n,3,5,8];delta[n_]:=If[IntegerQ[Sqrt[n]],1,0];f[n_]:=Table[n-k^2, {k,1,Floor[Sqrt[n]]}]; gamma[n_]:=2 Plus@@(e[ #,1,3,4] &/@f[n]);p3[n_]:=1/12(alpha[n]+beta[n]+gamma[n]);p3[ # ] &/@Range[0,104]
    (* Ant King, Oct 15 2010 *)
    a[ n_] := If[ n < 0, 0, Sum[ Boole[ n == i^2 + j^2 + k^2], {i, 0, Sqrt[n]}, {j, 0, i}, {k, 0, j}]]; (* Michael Somos, Aug 15 2015 *)
  • PARI
    {a(n) = if( n<0, 0, sum( i=0, sqrtint(n), sum( j=0, i, sum( k=0, j, n == i^2 + j^2 + k^2))))}; /* Michael Somos, Jun 05 2012 */
    
  • Python
    import collections; a = collections.Counter(i*i + j*j + k*k for i in range(100) for j in range(i+1) for k in range(j+1)) # David Radcliffe, Apr 15 2019

Formula

Let e(n,r,s,m) be the excess of the number of n's r(mod m) divisors over the number of its s (mod m) divisors, and let delta(n)=1 if n is a perfect square and 0 otherwise. Then, if we define alpha(n) = 5*delta(n) + 3*delta(n/2) + 4*delta(n/3), beta(n) = 4*e(n,1,3,4) + 3*e(n,1,7,8) + 3*e(n,3,5,8), gamma(n) = 2*Sum_{1<=k^2Ant King, Oct 15 2010

Extensions

Name clarified by Wolfdieter Lang, Apr 08 2013

A006431 Numbers that have a unique partition into a sum of four nonnegative squares.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 8, 11, 14, 15, 23, 24, 32, 56, 96, 128, 224, 384, 512, 896, 1536, 2048, 3584, 6144, 8192, 14336, 24576, 32768, 57344, 98304, 131072, 229376, 393216, 524288, 917504, 1572864, 2097152, 3670016, 6291456, 8388608, 14680064
Offset: 1

Views

Author

David M. Bloom

Keywords

Comments

From a(16) = 96 onwards, the terms of this sequence satisfy the third-order recurrence relation a(n) = 4a(n-3). - Ant King, Aug 15 2010
A002635(a(n)) = 1. - Reinhard Zumkeller, Jul 13 2014

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, New York, 1985, p. 86, Theorem 1.

Crossrefs

Programs

  • Haskell
    a006431 n = a006431_list !! (n-1)
    a006431_list = filter ((== 1) . a002635) [0..]
    -- Reinhard Zumkeller, Jul 13 2014
  • Mathematica
    Select[Range[0,3584], Length[PowersRepresentations[ #,4,2]] == 1&] (* Ant King, Aug 15 2010 *)
    CoefficientList[Series[x  (36 x^13 + 28 x^12 + 32 x^11 + 21 x^10 + 17 x^9 + 14 x^8 + 13 x^7 + 12 x^6 + 5 x^5 + 2 x^4 - x^3 - 3 x^2 - 2 x - 1)/(4 x^3 - 1), {x, 0, 50}], x] (* Vincenzo Librandi, Oct 14 2013 *)
    LinearRecurrence[{0,0,4},{0,1,2,3,5,6,7,8,11,14,15,23,24,32,56},50] (* Harvey P. Dale, Nov 26 2015 *)
  • PARI
    {a(n)=if(n<2, 0, if(n<15, [1, 2, 3, 5, 6, 7, 8, 11, 14, 15, 23, 24, 32] [n-1], [4, 7, 12][n%3+1]*2^(n\3*2-7)))} /* Michael Somos, Apr 23 2006 */
    

Formula

Consists of the seven odd numbers 1, 3, 5, 7, 11, 15, 23, plus 0, and numbers of forms 2*4^k, 6*4^k, 14*4^k, k >= 0.
The set {n nonnegative : A002635(n) = 1}.
G.f.: x^2*(36*x^13 +28*x^12 +32*x^11 +21*x^10 +17*x^9 +14*x^8 +13*x^7 +12*x^6 +5*x^5 +2*x^4 -x^3 -3*x^2 -2*x -1) / (4*x^3 -1). - Colin Barker, Apr 20 2013
log(a(n)) = n*log(4)/3 + C(n) + o(1) where C(n) ~ {-2.82922, -3.00364, -2.90612} for n (mod 3) == {2,0,1}. - Bill McEachen, Oct 21 2022

Extensions

More terms from James Sellers, Dec 24 1999
Corrected by T. D. Noe, Jun 15 2006
Definition revised by Ant King, May 06 2010
Edited and Grosswald reference added by Wolfdieter Lang, Aug 12 2015

A002636 Number of ways of writing n as an unordered sum of at most 3 nonzero triangular numbers.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 3, 2, 1, 2, 3, 2, 2, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 1, 4, 4, 2, 2, 3, 2, 3, 4, 2, 3, 3, 2, 4, 3, 2, 4, 4, 2, 4, 4, 1, 4, 5, 1, 2, 3, 4, 6, 4, 3, 2, 5, 2, 3, 3, 3, 6, 5, 2, 2, 5, 3, 5, 4, 2, 4, 5, 3, 4, 5, 2, 4, 6, 2, 6, 3, 3, 6, 3, 2, 3, 7, 3, 6, 6, 2, 4, 6, 3, 2
Offset: 0

Views

Author

N. J. A. Sloane, Sep 18 2001

Keywords

Comments

Fermat asserted that every number is the sum of three triangular numbers. This was proved by Gauss, who recorded in his Tagebuch entry for Jul 10 1796 that: EYPHKA! num = DELTA + DELTA + DELTA.
a(n) <= A167618(n). - Reinhard Zumkeller, Nov 07 2009
Equivalently, number of ways of writing n as an unordered sum of exactly 3 triangular numbers. - Jon E. Schoenfield, Mar 28 2021

Examples

			0 : empty sum
1 : 1
2 : 1+1
3 : 3 = 1+1+1
4 : 3+1
5 : 3+1+1
6 : 6 = 3+3
7 : 6+1 = 3+3+1
...
13 : 10 + 3 = 6 + 6 + 1, so a(13) = 2.
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102, eq. (8).
  • D. H. Lehmer, Review of Loria article, Math. Comp. 2 (1947), 301-302.
  • G. Loria, Sulla scomposizione di un intero nella somma di numeri poligonali. (Italian) Atti Accad. Naz. Lincei. Rend. Cl. Sci. Fis. Mat. Nat. (8) 1, (1946). 7-15.
  • Mel Nathanson, Additive Number Theory: The Classical Bases, Graduate Texts in Mathematics, Volume 165, Springer-Verlag, 1996. See Chapter 1.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    # reuses code in A000217
    A002636 := proc(n)
        local a,i,Ti, j,Tj, Tk ;
        a := 0 ;
        for i from 0 do
            Ti := A000217(i) ;
            if Ti > n then
                break ;
            end if;
            for j from i do
                Tj := A000217(j) ;
                if Ti+Tj > n then
                    break ;
                end if;
                Tk := n-Ti-Tj ;
                if Tk >= Tj and isA000217(Tk) then
                    a := a+1 ;
                end if;
                if Tk < Tj then
                    break ;
                end if;
            end do:
        end do:
        a ;
    end proc:
    seq(A002636(n),n=0..40) ; # R. J. Mathar, May 26 2025
  • Mathematica
    a = Table[ n(n + 1)/2, {n, 0, 15} ]; b = {0}; c = Table[ 0, {100} ]; Do[ b = Append[ b, a[ [ i ] ] + a[ [ j ] ] + a[ [ k ] ] ], {k, 1, 15}, {j, 1, k}, {i, 1, j} ]; b = Delete[ b, 1 ]; b = Sort[ b ]; l = Length[ b ]; Do[ If[ b[ [ n ] ] < 100, c[ [ b[ [ n ] ] + 1 ] ]++ ], {n, 1, l} ]; c
  • PARI
    first(n)=my(v=vector(n+1),A,B,C); for(a=0,n, A=a*(a+1)/2; if(A>n, break); for(b=0,a, B=A+b*(b+1)/2; if(B>n, break); for(c=0,b, C=B+c*(c+1)/2; if(C>n, break); v[C+1]++))); v \\ Charles R Greathouse IV, Jun 23 2017

Extensions

More terms from Robert G. Wilson v, Sep 20 2001
Entry revised by N. J. A. Sloane, Feb 25 2007

A000174 Number of partitions of n into 5 squares.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 3, 2, 1, 3, 3, 3, 3, 4, 3, 3, 2, 2, 4, 4, 4, 4, 5, 3, 3, 4, 3, 5, 5, 5, 6, 5, 3, 5, 5, 5, 6, 5, 6, 5, 4, 4, 6, 7, 6, 8, 8, 7, 5, 6, 5, 8, 8, 4, 9, 7, 6, 7, 7, 8, 9, 9, 7, 9, 6, 7, 8, 10, 9, 9, 11, 7, 8, 8, 8, 11, 11, 9, 12, 11, 7, 9, 9, 12, 13, 9, 10, 11, 8, 6, 10, 13, 13, 13
Offset: 0

Views

Author

Keywords

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 84.

Crossrefs

Equivalent sequences for other numbers of squares: A010052 (1), A000161 (2), A000164 (3), A002635 (4), A000177 (6), A025422 (7), A025423 (8), A025424 (9), A025425 (10).
Cf. A025429, A295160 (largest number k with a(k) = n).

Programs

  • Mathematica
    Table[PowersRepresentations[n, 5, 2] // Length, {n, 0, 100}] (* Jean-François Alcover, Feb 04 2016 *)

A180149 Integers with precisely two partitions into sums of four squares of nonnegative numbers.

Original entry on oeis.org

4, 9, 10, 12, 13, 16, 17, 19, 20, 21, 22, 29, 30, 31, 35, 39, 40, 44, 46, 47, 48, 64, 71, 80, 88, 120, 160, 176, 184, 192, 256, 320, 352, 480, 640, 704, 736, 768, 1024, 1280, 1408, 1920, 2560, 2816, 2944, 3072, 4096, 5120, 5632, 7680
Offset: 1

Views

Author

Ant King, Aug 17 2010

Keywords

Comments

The largest odd member of this sequence is 71, and from a(32)=320 onwards the terms satisfy the eighth-order recurrence relation a(n)=4a(n-8).
A002635(a(n)) = 2. - Reinhard Zumkeller, Jul 13 2014

Examples

			As the fifth integer which has precisely two partitions into sums of four squares of nonnegative numbers is 13, then a(5)=13.
		

Crossrefs

Programs

  • Haskell
    a180149 n = a180149_list !! (n-1)
    a180149_list = filter ((== 2) . a002635) [0..]
    -- Reinhard Zumkeller, Jul 13 2014
  • Mathematica
    Select[Range[10000], Length[PowersRepresentations[ #, 4, 2]]==2&]

Formula

The members of this sequence are {9, 13, 17, 19, 21, 29, 30, 31, 35, 39, 46, 47, 71} together with all integers of the form 5*2^N, 11*2^N and {1,3,30,46}*4^N where N > 0 (which includes a necessary correction to Lehmer's result).

A245022 Integers with precisely three partitions into sums of four squares of nonnegative numbers.

Original entry on oeis.org

18, 25, 26, 27, 28, 33, 37, 38, 41, 43, 51, 53, 55, 59, 60, 62, 72, 79, 92, 95, 104, 112, 152, 240, 248, 288, 368, 416, 448, 608, 960, 992, 1152, 1472, 1664, 1792, 2432, 3840, 3968, 4608, 5888, 6656, 7168, 9728, 15360, 15872, 18432, 23552, 26624, 28672
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 13 2014

Keywords

Comments

A002635(a(n)) = 3.

Examples

			a(1) = 18 = 16 + 1 + 1 + 0 = 9 + 9 + 0 + 0 = 9 + 4 + 4 + 1;
a(2) = 25 = 25 + 0 + 0 + 0 = 16 + 9 + 0 + 0 = 16 + 4 + 4 + 1;
a(3) = 26 = 25 + 1 + 0 + 0 = 16 + 9 + 1 + 0 = 9 + 9 + 4 + 4;
a(4) = 27 = 25 + 1 + 1 + 0 = 16 + 9 + 1 + 1 = 9 + 9 + 9 + 0;
a(5) = 28 = 25 + 1 + 1 + 1 = 16 + 4 + 4 + 4 = 9 + 9 + 9 + 1;
a(6) = 33 = 25 + 4 + 4 + 0 = 16 + 16 + 1 + 0 = 16 + 9 + 4 + 4;
a(7) = 37 = 36 + 1 + 0 + 0 = 25 + 4 + 4 + 4 = 16 + 16 + 4 + 1;
a(8) = 38 = 36 + 1 + 1 + 0 = 25 + 9 + 4 + 0 = 16 + 9 + 9 + 4;
a(9) = 41 = 36 + 4 + 1 + 0 = 25 + 16 + 0 + 0 = 16 + 16 + 9 + 0;
a(10) = 43 = 25 + 16 + 1 + 1 = 25 + 9 + 9 + 0 = 16 + 9 + 9 + 9;
a(11) = 51 = 49 + 1 + 1 + 0 = 25 + 25 + 1 + 0 = 25 + 16 + 9 + 1;
a(12) = 53 = 49 + 4 + 0 + 0 = 36 + 16 + 1 + 0 = 36 + 9 + 4 + 4.
		

Crossrefs

Programs

  • Haskell
    a245022 n = a245022_list !! (n-1)
    a245022_list = filter ((== 3) . a002635) [0..]
  • Mathematica
    Select[ Range@ 30000, Length@PowersRepresentations[#, 4, 2] == 3 &] (* Robert G. Wilson v, Oct 27 2017 *)

Extensions

a(44)-a(50) from Robert Price, Oct 26 2017

A294282 Integers with precisely four partitions into sums of four squares of nonnegative numbers.

Original entry on oeis.org

34, 36, 42, 45, 49, 57, 61, 63, 65, 67, 68, 69, 77, 78, 83, 87, 94, 107, 116, 119, 136, 144, 168, 272, 312, 376, 464, 544, 576, 672, 1088, 1248, 1504, 1856, 2176, 2304, 2688, 4352, 4992, 6016, 7424, 8704, 9216, 10752, 17408, 19968, 24064, 29696, 34816, 36864, 43008, 69632, 79872, 96256
Offset: 1

Views

Author

Robert Price, Oct 26 2017

Keywords

Comments

A002635(a(n)) = 4.

Crossrefs

Programs

  • Mathematica
    f[n_]:=Length@PowersRepresentations[n, 4, 2]; Select[Range@850, f@#==4 &] (* Vincenzo Librandi, Oct 28 2017 *)

A294297 Integers with precisely five partitions into sums of four squares of nonnegative numbers.

Original entry on oeis.org

50, 52, 54, 58, 70, 73, 74, 75, 76, 84, 85, 86, 89, 91, 93, 101, 103, 109, 111, 113, 127, 131, 140, 142, 143, 151, 167, 191, 200, 208, 216, 232, 280, 296, 304, 336, 344, 560, 568, 800, 832, 864, 928, 1120, 1184, 1216, 1344, 1376, 2240, 2272, 3200, 3328, 3456
Offset: 1

Views

Author

Robert Price, Oct 27 2017

Keywords

Comments

A002635(a(n)) = 5.

Crossrefs

Programs

  • Mathematica
    f[n_] := Length@ PowersRepresentations[n, 4, 2]; Select[ Range@ 3500, f@# == 5 &] (* Robert G. Wilson v, Oct 27 2017 *)

A124978 Smallest positive number which has exactly n different partitions as a sum of 4 squares x^2+y^2+z^2+t^2.

Original entry on oeis.org

1, 4, 18, 34, 50, 66, 82, 114, 90, 130, 150, 178, 162, 198, 318, 210, 250, 234, 322, 406, 465, 330, 306, 402, 462, 390, 474, 378, 490, 486, 654, 610, 522, 450, 778, 678, 642, 570, 666, 726, 594, 714, 770, 774, 986, 630, 738, 945, 1035, 850, 1222, 978, 1014, 918
Offset: 1

Views

Author

Artur Jasinski, Nov 14 2006

Keywords

Comments

Is it known that a(n) always exists? - Franklin T. Adams-Watters, Dec 18 2006
A002635(a(n)) = n. - Reinhard Zumkeller, Jul 13 2014

Examples

			a(4)=34 because 34 is smallest number which has 4 partitions 34=4^2+3^2+3^2+0^2 = 4^2+4^2+1^2+1^2 = 5^2+2^2+2^2+1^2 = 5^2+3^2+0^2+0^2
a(3)=18 which has 3 partitions 18=0^2+0^2+3^2+3^2=0^2+1^2+1^2+4^2=1^2+2^2+2^2+3^2.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a124978 = (+ 1) . fromJust . (`elemIndex` (tail a002635_list))
    -- Reinhard Zumkeller, Jul 13 2014
  • Mathematica
    kmin[n_] := If[n<5, 1, 10n](* empirical, should be lowered in case of doubt *);
    a[n_] := a[n] = For[k=kmin[n], True, k++, If[Length[PowersRepresentations[ k, 4, 2]] == n, Return[k]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 1000}] (* Jean-François Alcover, Mar 11 2019 *)
  • PARI
    cnt4sqr(n)={ local(cnt=0,t2) ; for(x=0,floor(sqrt(n)), for(y=x,floor(sqrt(n-x^2)), for(z=y,floor(n-x^2-y^2), t2=n-x^2-y^2-z^2 ; if( t2>=z^2 && issquare(n-x^2-y^2-z^2), cnt++ ; ) ; ) ; ) ; ) ; return(cnt) ; }
    A124978(n)= { local(a=1) ; while(1, if( cnt4sqr(a)==n, return(a) ; ) ; a++ ; ) ; }
    { for(n=1,100, print(n," ",A124978(n)) ; ) ; } \\ R. J. Mathar, Nov 29 2006
    

Extensions

Corrected and extended by R. J. Mathar, Nov 29 2006
More terms from Franklin T. Adams-Watters, Dec 18 2006
Showing 1-10 of 24 results. Next