A365321 Number of pairs of distinct positive integers <= n that cannot be linearly combined with positive coefficients to obtain n.
0, 0, 1, 2, 4, 6, 10, 13, 18, 24, 30, 37, 46, 54, 63, 77, 85, 99, 111, 127, 141, 161, 171, 194, 210, 235, 246, 277, 293, 322, 342, 372, 389, 428, 441, 491, 504, 545, 561, 612, 635, 680, 701, 753, 773, 836, 846, 911, 932, 1000, 1017, 1082, 1103, 1176, 1193
Offset: 0
Keywords
Examples
For the pair p = (2,3) we have 4 = 2*2 + 0*3, so p is not counted under A365320(4), but it is not possible to write 4 as a positive linear combination of 2 and 3, so p is counted under a(4). The a(2) = 1 through a(7) = 13 pairs: (1,2) (1,3) (1,4) (1,5) (1,6) (1,7) (2,3) (2,3) (2,4) (2,3) (2,4) (2,4) (2,5) (2,5) (2,6) (3,4) (3,4) (2,6) (2,7) (3,5) (3,4) (3,5) (4,5) (3,5) (3,6) (3,6) (3,7) (4,5) (4,5) (4,6) (4,6) (5,6) (4,7) (5,6) (5,7) (6,7)
Crossrefs
Programs
-
Mathematica
combp[n_,y_]:=With[{s=Table[{k,i},{k,y},{i,1,Floor[n/k]}]},Select[Tuples[s],Total[Times@@@#]==n&]]; Table[Length[Select[Subsets[Range[n],{2}], combp[n,#]=={}&]],{n,0,30}]
-
Python
from itertools import count from sympy import divisors def A365321(n): a = set() for i in range(1,n+1): for j in count(i,i): if j >= n: break for d in divisors(n-j): if d>=i: break a.add((d,i)) return (n*(n-1)>>1)-len(a) # Chai Wah Wu, Sep 12 2023
Comments