login
Number of distinct values of the sum of 2 products of two 0..n integers.
2

%I #31 Oct 13 2023 19:20:43

%S 1,3,8,16,27,42,59,81,105,134,167,203,241,285,331,381,436,495,556,622,

%T 690,764,841,920,1002,1091,1184,1279,1378,1482,1588,1700,1813,1932,

%U 2053,2177,2308,2443,2579,2719,2862,3012,3164,3322,3481,3645,3814,3985,4158,4339

%N Number of distinct values of the sum of 2 products of two 0..n integers.

%H David A. Corneth, <a href="/A225253/b225253.txt">Table of n, a(n) for n = 0..3000</a> (first 999 terms from R. H. Hardin)

%H David A. Corneth, <a href="/A225253/a225253.gp.txt">PARI program</a>

%e a(3) = 16 as the possible products i*j where 0 <= i, j <= 3 are 0, 1, 2, 3, 4, 6, 9. From these numbers we can find the 16 distinct sums, listed with a few examples, 0, 1, 2, 3, 4, 5, 6, 7 = 3+4, 8, 9, 10, 11, 12 = 6+6, 13 = 4+9, 15, 18. - _David A. Corneth_, Sep 07 2023

%o (PARI) a(n) = #setbinop((x,y)->x+y, setbinop((x,y)->x*y, [0..n])); \\ _Michel Marcus_, Sep 06 2023

%o (PARI) See PARI link \\ _David A. Corneth_, Sep 07 2023

%o (Python)

%o from itertools import combinations_with_replacement

%o def A225253(n): return len({x+y for x,y in combinations_with_replacement({i*j for i in range(n+1) for j in range(i+1)},2)}) # _Chai Wah Wu_, Oct 13 2023

%Y Row 2 of A225252.

%Y Cf. A027384, A062854, A225254.

%K nonn

%O 0,2

%A _R. H. Hardin_, May 04 2013

%E a(0)=1 prepended by _Alois P. Heinz_, Oct 13 2023