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.

A347498 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.

Original entry on oeis.org

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, 51, 53, 55, 57, 59, 61, 67, 69, 71, 73, 75, 79, 83
Offset: 1

Views

Author

Peter Kagey, Sep 03 2021

Keywords

Comments

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

Examples

			   n | example set
-----+-------------------------------------------------------
   1 | {1}
   2 | {1, 2}
   3 | {1, 2, 3}
   4 | {1, 2, 3, 5}
   5 | {1, 3, 4, 5,  6}
   6 | {1, 3, 4, 5,  6,  7}
   7 | {1, 2, 5, 6,  7,  8,  9}
   8 | {1, 2, 5, 6,  7,  8,  9, 11}
   9 | {1, 2, 5, 6,  7,  8,  9, 11, 13}
  10 | {1, 2, 5, 7,  8,  9, 11, 12, 13, 15}
  11 | {1, 2, 5, 7,  8,  9, 11, 12, 13, 15, 17}
  12 | {1, 2, 5, 7,  8,  9, 11, 12, 13, 15, 17, 19}
  13 | {1, 5, 6, 7,  9, 11, 13, 14, 15, 16, 17, 19, 20}
  14 | {1, 2, 5, 7, 11, 12, 13, 16, 17, 18, 19, 20, 21, 23}
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.
		

Crossrefs

Analogous for sums: A003022 and A227590.

Programs

  • Mathematica
    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 *)
  • Python
    from itertools import combinations, combinations_with_replacement
    def a(n):
        k = n
        while True:
            for Srest in combinations(range(1, k), n-1):
                S = Srest + (k, )
                allprods = set()
                for i, j in combinations_with_replacement(S, 2):
                    if i*j in allprods: break
                    else: allprods.add(i*j)
                else: return k
            k += 1
    print([a(n) for n in range(1, 15)]) # Michael S. Branicky, Sep 08 2021

Formula

a(n) = min {k >= 1; A338006(k) = n}. - Pontus von Brömssen, Sep 09 2021

Extensions

a(15)-a(20) from Michael S. Branicky, Sep 08 2021
a(21)-a(38) (based on the terms in A338006) from Pontus von Brömssen, Sep 09 2021