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.

A338939 a(n) is the number of partitions n = a + b such that a*b is a perfect square.

This page as a plain text file.
%I A338939 #33 Oct 25 2024 09:49:10
%S A338939 0,1,0,1,1,1,0,1,0,3,0,1,1,1,1,1,1,1,0,3,0,1,0,1,2,3,0,1,1,3,0,1,0,3,
%T A338939 1,1,1,1,1,3,1,1,0,1,1,1,0,1,0,5,1,3,1,1,1,1,0,3,0,3,1,1,0,1,4,1,0,3,
%U A338939 0,3,0,1,1,3,2,1,0,3,0,3,0,3,0,1,4,1,1,1,1,3,1,1,0,1,1,1,1,1,0,5
%N A338939 a(n) is the number of partitions n = a + b such that a*b is a perfect square.
%C A338939 Number of ways to regroup the unit squares of a rectangle with semiperimeter n into a square.
%C A338939 a(n) > 0 for n in A337140.
%H A338939 David A. Corneth, <a href="/A338939/b338939.txt">Table of n, a(n) for n = 1..10000</a>
%F A338939 Let n = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 *...* q_s^b_s with t >= 0, a_i >= 0 for i = 1..r, where p_i == 1 (mod 4) and q_j == -1 (mod 4) for j = 1..s. Further, let A = (2a_1 + 1)*(2a_2 + 1)*...*(2a_r + 1). Then a(n) = (A-1)/2 for odd n and a(n) = A for even n.
%F A338939 a(n) = A338940(n) / A115878(n).
%e A338939 n = 10 = 1 + 9 = 2 + 8 = 5 + 5 with 1*9 = 3^2 and 2*8 = 4^2 and 5*5 = 5^2. Then a(10) = 3. Also 10 = 2^1 * 5^1. So t=1, a_1=1 and a(n) = A = 2*1+1 = 3.
%p A338939 A338939:=n->map[fold=(`+`,0)](i->if(issqr(i*(n-i)),1,0),[$1..1/2*n]); seq(A338939(n),n=1..100); # _Felix Huber_, Oct 02 2024
%t A338939 a[n_] := Count[IntegerPartitions[n, {2}], _?(IntegerQ @ Sqrt[Times @@ #] &)]; Array[a, 100] (* _Amiram Eldar_, Nov 22 2020 *)
%o A338939 (PARI) a(n)=my(c=0);for(i=1,n-1,if((2*i<=n)&&issquare(i*(n-i)),c++));c
%o A338939 for(n=1,100,print1(a(n),", ")) \\ _Derek Orr_, Nov 18 2020
%o A338939 (PARI) a(n) = sum(i=1, n-1, (2*i<=n) && issquare(i*(n-i))); \\ _Michel Marcus_, Dec 21 2020
%o A338939 (PARI) first(n) = {my(res = vector(n)); for(i = 1, n, d = divisors(i^2); for(i = (#d + 1)\2, #d, c = d[i] + d[#d + 1 - i]; if(c <= n, res[c]++ , next(2) ) ) ); res } \\ _David A. Corneth_, Dec 21 2020
%o A338939 (Python)
%o A338939 from sympy.abc import x,y
%o A338939 from sympy.solvers.diophantine.diophantine import diop_quadratic
%o A338939 def A338939(n): return len(diop_quadratic(x*(n-x)-y**2))>>2 # _Chai Wah Wu_, Aug 21 2024
%Y A338939 Cf. A115878, A337140, A338940.
%K A338939 nonn
%O A338939 1,10
%A A338939 _Hein van Winkel_, Nov 16 2020