%I #50 Oct 13 2023 19:29:07
%S 1,2,4,7,10,15,19,26,31,37,43,54,60,73,81,90,98,115,124,143,153,165,
%T 177,200,210,226,240,255,268,297,309,340,355,373,391,411,424,461,481,
%U 502,518,559,576,619,639,660,684,731,748,779,801,828,851,904,926,957,979,1009,1039
%N Number of distinct products i*j with 0 <= i, j <= n.
%C a(n) = A027420(n,0) = A027420(n,n). - _Reinhard Zumkeller_, May 02 2014
%H Seiichi Manyama, <a href="/A027384/b027384.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..1000 from T. D. Noe)
%H R. P. Brent, C. Pomerance, D. Purdum, and J. Webster, <a href="https://arxiv.org/abs/1908.04251">Algorithms for the multiplication table</a>, arXiv:1908.04251 [math.NT], 2019-2021.
%F For prime p, a(p) = a(p - 1) + p. - _David A. Corneth_, Jan 01 2019
%p A027384 := proc(n)
%p local L,i,j ;
%p L := {};
%p for i from 0 to n do
%p for j from i to n do
%p L := L union {i*j};
%p end do:
%p end do:
%p nops(L);
%p end proc: # _R. J. Mathar_, May 06 2016
%t u = {}; Table[u = Union[u, n*Range[0, n]]; Length[u], {n, 0, 100}] (* _T. D. Noe_, Jan 07 2012 *)
%o (Haskell)
%o import Data.List (nub)
%o a027384 n = length $ nub [i*j | i <- [0..n], j <- [0..n]]
%o -- _Reinhard Zumkeller_, Jan 01 2012
%o (PARI) a(n) = {my(s=Set()); for (i=0, n, s = setunion(s, Set(vector(n+1, k, i*(k-1))));); #s;} \\ _Michel Marcus_, Jan 01 2019
%o (Python)
%o def A027384(n): return len({i*j for i in range(1,n+1) for j in range(1,i+1)})+1 # _Chai Wah Wu_, Oct 13 2023
%Y Equals A027424 + 1, n>0.
%Y Cf. A027417, A027427, A027425.
%K nonn,easy
%O 0,2
%A Fred Schwab (fschwab(AT)nrao.edu)