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.

A025426 Number of partitions of n into 2 nonzero squares.

This page as a plain text file.
%I A025426 #66 Dec 28 2023 10:41:34
%S A025426 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,
%T A025426 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,
%U A025426 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
%N A025426 Number of partitions of n into 2 nonzero squares.
%C A025426 For records see A007511, A048610, A016032. - _R. J. Mathar_, Feb 26 2008
%H A025426 Robin Jones, <a href="/A025426/b025426.txt">Table of n, a(n) for n = 0..20000</a> (Terms 0..10000 from Reinhard Zumkeller).
%H A025426 Vaclav Kotesovec, <a href="/A025426/a025426.jpg">Graph - the asymptotic ratio (10^8 terms)</a>
%H A025426 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%F A025426 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
%F A025426 a(A018825(n)) = 0; a(A000404(n)) > 0; a(A025284(n)) = 1; a(A007692(n)) > 1. - _Reinhard Zumkeller_, Aug 16 2011
%F A025426 a(A000578(n)) = A084888(n). - _Reinhard Zumkeller_, Jul 18 2012
%F A025426 a(n) = Sum_{i=1..floor(n/2)} A010052(i) * A010052(n-i). - _Wesley Ivan Hurt_, Apr 19 2019
%F A025426 a(n) = [x^n y^2] Product_{k>=1} 1/(1 - y*x^(k^2)). - _Ilya Gutkovskiy_, Apr 19 2019
%F A025426 Conjecture: Sum_{k=1..n} a(k) ~ n*Pi/8. - _Vaclav Kotesovec_, Dec 28 2023
%p A025426 A025426 := proc(n)
%p A025426     local a,x;
%p A025426     a := 0 ;
%p A025426     for x from 1 do
%p A025426         if 2*x^2 > n then
%p A025426             return a;
%p A025426         end if;
%p A025426         if issqr(n-x^2) then
%p A025426             a := a+1 ;
%p A025426         end if;
%p A025426     end do:
%p A025426 end proc: # _R. J. Mathar_, Sep 15 2015
%t A025426 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_ *)
%t A025426 nmax = 107; sq = Range[Sqrt[nmax]]^2;
%t A025426 Table[Length[Select[IntegerPartitions[n, All, sq], Length[#] == 2 &]], {n, 0, nmax}] (* _Robert Price_, Aug 17 2020 *)
%o A025426 (Haskell)
%o A025426 a025426 n = sum $ map (a010052 . (n -)) $
%o A025426                       takeWhile (<= n `div` 2) $ tail a000290_list
%o A025426 a025426_list = map a025426 [0..]
%o A025426 -- _Reinhard Zumkeller_, Aug 16 2011
%o A025426 (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
%o A025426 (Python)
%o A025426 from math import prod
%o A025426 from sympy import factorint
%o A025426 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
%Y A025426 Cf. A000161 (2 nonnegative squares), A063725 (order matters), A025427 (3 nonzero squares).
%Y A025426 Cf. A172151, A004526. - _Reinhard Zumkeller_, Jan 26 2010
%Y A025426 Column k=2 of A243148.
%K A025426 nonn,easy
%O A025426 0,51
%A A025426 _David W. Wilson_