login
a(n) is the number of distinct products i*j minus the number of distinct sums i+j with 1 <= i, j <= n.
1

%I #35 Jul 13 2024 17:55:10

%S 0,0,1,2,5,7,12,15,19,23,32,36,47,53,60,66,81,88,105,113,123,133,154,

%T 162,176,188,201,212,239,249,278,291,307,323,341,352,387,405,424,438,

%U 477,492,533,551,570,592,637,652,681,701,726,747,798,818,847,867,895

%N a(n) is the number of distinct products i*j minus the number of distinct sums i+j with 1 <= i, j <= n.

%F a(n) = A027424(n) - A005408(n-1).

%F a(n) = (n-1)^2 - A062851(n).

%e a(5) = 5 because:

%e Products: Sums:

%e * | 1 | 2 | 3 | 4 | 5 + | 1 | 2 | 3 | 4 | 5

%e ------------------------- -----------------------

%e 1 | 1 | 2 | 3 | 4 | 5 1 | 2 | 3 | 4 | 5 | 6

%e 2 | 2 | 4 | 6 | 8 | 10 2 | 3 | 4 | 5 | 6 | 7

%e 3 | 3 | 6 | 9 | 12 | 15 3 | 4 | 5 | 6 | 7 | 8

%e 4 | 4 | 8 | 12 | 16 | 20 4 | 5 | 6 | 7 | 8 | 9

%e 5 | 5 | 10 | 15 | 20 | 25 5 | 6 | 7 | 8 | 9 | 10

%e The number of distinct products [1,2,3,4,5,6,8,9,10,12,15,16,20,25] is 14.

%e The number of distinct sums [2,3,4,5,6,7,8,9,10] is 9.

%e So a(5) = 14 - 9 = 5.

%o (Python)

%o A027424 = lambda n: len({i*j for i in range(1, n+1) for j in range(1, i+1)})

%o a = lambda n: A027424(n)-((n<<1)-1)

%o print([a(n) for n in range(1, 58)])

%o (PARI) a(n) = #setbinop((x, y)->x*y, vector(n, i, i)) - 2*n + 1; \\ _Michel Marcus_, Jun 23 2024

%Y Cf. A000290, A005408, A027424, A062851.

%K nonn

%O 1,4

%A _DarĂ­o Clavijo_, Jun 22 2024