cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

0, 0, 1, 2, 5, 7, 12, 15, 19, 23, 32, 36, 47, 53, 60, 66, 81, 88, 105, 113, 123, 133, 154, 162, 176, 188, 201, 212, 239, 249, 278, 291, 307, 323, 341, 352, 387, 405, 424, 438, 477, 492, 533, 551, 570, 592, 637, 652, 681, 701, 726, 747, 798, 818, 847, 867, 895
Offset: 1

Views

Author

DarĂ­o Clavijo, Jun 22 2024

Keywords

Examples

			a(5) = 5 because:
 Products:                   Sums:
 * | 1 |  2 |  3 |  4 |  5   + | 1 | 2 | 3 | 4 |  5
 -------------------------   -----------------------
 1 | 1 |  2 |  3 |  4 |  5   1 | 2 | 3 | 4 | 5 |  6
 2 | 2 |  4 |  6 |  8 | 10   2 | 3 | 4 | 5 | 6 |  7
 3 | 3 |  6 |  9 | 12 | 15   3 | 4 | 5 | 6 | 7 |  8
 4 | 4 |  8 | 12 | 16 | 20   4 | 5 | 6 | 7 | 8 |  9
 5 | 5 | 10 | 15 | 20 | 25   5 | 6 | 7 | 8 | 9 | 10
The number of distinct products [1,2,3,4,5,6,8,9,10,12,15,16,20,25] is 14.
The number of distinct sums [2,3,4,5,6,7,8,9,10] is 9.
So a(5) = 14 - 9 = 5.
		

Crossrefs

Programs

  • PARI
    a(n) = #setbinop((x, y)->x*y, vector(n, i, i)) - 2*n + 1; \\ Michel Marcus, Jun 23 2024
  • Python
    A027424 = lambda n: len({i*j for i in range(1, n+1) for j in range(1, i+1)})
    a = lambda n: A027424(n)-((n<<1)-1)
    print([a(n) for n in range(1, 58)])
    

Formula

a(n) = A027424(n) - A005408(n-1).
a(n) = (n-1)^2 - A062851(n).