login
A302292
Number of positive integer pairs (x,y) such that there exist positive integers p and q satisfying p*x + q*y = n.
1
0, 1, 3, 6, 9, 13, 17, 23, 26, 33, 37, 45, 49, 59, 59, 74, 75, 89, 89, 103, 101, 123, 119, 139, 132, 161, 151, 175, 169, 193, 187, 219, 203, 243, 211, 260, 243, 287, 261, 297, 281, 327, 301, 351, 313, 381, 341, 401, 354, 421, 389, 451, 405, 483, 409, 489, 457, 537, 471, 547, 495, 593, 509, 610, 521, 645, 565, 669, 601
OFFSET
1,3
FORMULA
a(n) = A302294(n) - 2*A000005(n). - Chai Wah Wu, May 24 2018
EXAMPLE
a(5)=9; all pairs are (1, 2), (3, 2), (1, 3), (3, 1), (2, 1), (1, 4), (2, 3), (4, 1), (1, 1).
MATHEMATICA
f[n_] := {#, n/#} & /@ Divisors@ n; Array[Length@ Union@ Apply[Join, {#, Reverse /@ #}] &@ Apply[Join, Map[Apply[Join, Outer[{#1, #2} &, #1, #2, 1]][[All, All, -1]] & @@ Map[f, #] &, IntegerPartitions[#, {2}]]] &, 68, 2] (* Michael De Vlieger, May 14 2018 *)
PROG
(Python)
def sets(n):
res=set()
for i in range(1, n):
for j in range(1, i+1):
if i%j==0:
for k in range(1, n-i+1):
if (n-i)%(k)==0:
res.add((j, k))
return res
[len(sets(i)) for i in range(1, 100)]
(PARI) isok(x, y, n) = {for (p=1, n, for (q=1, n, if (p*x+q*y ==n, return (1)); ); ); return (0); }
a(n) = sum(x=1, n, sum(y=1, n, isok(x, y, n))); \\ Michel Marcus, May 14 2018
(Python)
from __future__ import division
from sympy import divisors
def A302292(n):
s = set()
for i in range(1, (n+3)//2):
for j in divisors(i):
for k in divisors(n-i):
if j != k:
s.add((min(j, k), max(j, k)))
return divisor_count(n)+2*len(s)-1 # Chai Wah Wu, May 24 2018
CROSSREFS
Cf. A302294.
Sequence in context: A366566 A185173 A171662 * A235269 A004137 A080060
KEYWORD
nonn
AUTHOR
Jack Zhang, Apr 04 2018
STATUS
approved