login
Least k such that there exists an n-element subset S of {1,2,...,k} with the property that all products i * j are distinct for i <= j.
3

%I #27 Sep 09 2021 09:37:58

%S 1,2,3,5,6,7,9,11,13,15,17,19,20,23,25,28,29,31,33,37,40,41,42,43,47,

%T 51,53,55,57,59,61,67,69,71,73,75,79,83

%N Least k such that there exists an n-element subset S of {1,2,...,k} with the property that all products i * j are distinct for i <= j.

%C a(n) <= A066720(n) and a(n+1) >= a(n) + 1

%F a(n) = min {k >= 1; A338006(k) = n}. - _Pontus von Brömssen_, Sep 09 2021

%e n | example set

%e -----+-------------------------------------------------------

%e 1 | {1}

%e 2 | {1, 2}

%e 3 | {1, 2, 3}

%e 4 | {1, 2, 3, 5}

%e 5 | {1, 3, 4, 5, 6}

%e 6 | {1, 3, 4, 5, 6, 7}

%e 7 | {1, 2, 5, 6, 7, 8, 9}

%e 8 | {1, 2, 5, 6, 7, 8, 9, 11}

%e 9 | {1, 2, 5, 6, 7, 8, 9, 11, 13}

%e 10 | {1, 2, 5, 7, 8, 9, 11, 12, 13, 15}

%e 11 | {1, 2, 5, 7, 8, 9, 11, 12, 13, 15, 17}

%e 12 | {1, 2, 5, 7, 8, 9, 11, 12, 13, 15, 17, 19}

%e 13 | {1, 5, 6, 7, 9, 11, 13, 14, 15, 16, 17, 19, 20}

%e 14 | {1, 2, 5, 7, 11, 12, 13, 16, 17, 18, 19, 20, 21, 23}

%e For n = 4, the set {1,2,3,4} does not have distinct products because 2*2 = 1*4. However, the set {1,2,3,5} does have distinct products because 1*1, 1*2, 1*3, 1*5, 2*2, 2*3, 2*5, 3*3, 3*5, and 5*5 are all distinct.

%t Table[k=1;While[!Or@@(Length[s=Union[Sort/@Tuples[#,{2}]]]==Length@Union[Times@@@s]&/@Subsets[Range@k,{n}]),k++];k,{n,12}] (* _Giorgos Kalogeropoulos_, Sep 08 2021 *)

%o (Python)

%o from itertools import combinations, combinations_with_replacement

%o def a(n):

%o k = n

%o while True:

%o for Srest in combinations(range(1, k), n-1):

%o S = Srest + (k, )

%o allprods = set()

%o for i, j in combinations_with_replacement(S, 2):

%o if i*j in allprods: break

%o else: allprods.add(i*j)

%o else: return k

%o k += 1

%o print([a(n) for n in range(1, 15)]) # _Michael S. Branicky_, Sep 08 2021

%Y Analogous for sums: A003022 and A227590.

%Y Cf. A066720, A338006, A347499.

%K nonn,more

%O 1,2

%A _Peter Kagey_, Sep 03 2021

%E a(15)-a(20) from _Michael S. Branicky_, Sep 08 2021

%E a(21)-a(38) (based on the terms in A338006) from _Pontus von Brömssen_, Sep 09 2021