login
Number of positive integer pairs (x,y) such that there exist positive integers p and q satisfying p*x^2 + q*y = n.
1

%I #35 May 21 2020 06:05:52

%S 0,1,2,3,5,7,8,10,10,14,15,17,19,21,22,24,26,30,30,33,34,39,36,44,41,

%T 47,44,52,49,57,54,59,58,66,59,66,69,73,71,80,75,85,79,88,80,95,82,98,

%U 91,100,98,110,100,112,104,118,113,125,109,133,121,130,115,136,126,147,131,147,138,152,135,159,146,162,145

%N Number of positive integer pairs (x,y) such that there exist positive integers p and q satisfying p*x^2 + q*y = n.

%H Jack Zhang, <a href="/A302293/b302293.txt">Table of n, a(n) for n = 1..1000</a>

%e a(5)=5: the pairs are (1, 2), (1, 3), (1, 4), (2, 1), (1, 1).

%o (Python)

%o def sets(n):

%o s = set()

%o for i in range(1,n):

%o for j in range(1,i+1):

%o if i%j==0:

%o for k in range(1,n-i+1):

%o if (n-i)%(k**2)==0:

%o s.add((k, j))

%o return len(s)

%o [sets(i) for i in range(1,50)]

%o (PARI) isok(x, y, n) = {for (p=1, n, for (q=1, n, if (p*x+q*y ==n, return (1)););); return (0);}

%o a(n) = sum(x=1, n, sum(y=1, n, isok(x^2, y, n))); \\ _Michel Marcus_, May 14 2018

%o (Python)

%o from sympy import divisors, integer_nthroot

%o def A302293(n):

%o s = set()

%o for i in range(1,n):

%o for j in divisors(i):

%o if integer_nthroot(j,2)[1]:

%o for k in divisors(n-i):

%o s.add((j,k))

%o return len(s) # _Chai Wah Wu_, May 26 2018

%K nonn

%O 1,3

%A _Jack Zhang_, Apr 04 2018