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.
%I A373119 #47 Dec 30 2024 02:12:19 %S A373119 1,2,3,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,12,12,13,13,13,13,13, %T A373119 13,14,14,15,15,15,15,16,16,17,17,17,17,18,18,19,19,19,19,20,20,20,20, %U A373119 20,20,21,21,22,22,22,22,23,23,24,24,24,24,25,25,26,26,26 %N A373119 Cardinality of the largest subset of {1,...,n} such that no four distinct elements of this subset multiply to a square. %C A373119 a(n) >= A000720(n). %C A373119 a(n) ~ n/log n (Erdős-Sárközy-Sós). Best bounds currently are due to Pach-Vizer. %C A373119 a(n+1)-a(n) is either 0 or 1 for any n. (Is equal to 1 when n+1 is prime.) %C A373119 If "four" is replaced by "one", "two", "three", "five", or "any odd", one obtains A028391, A013928, A372306, A373178, and A373114 respectively. %H A373119 P. Erdős, A. Sárközy, and V. T. Sós, <a href="https://doi.org/10.1016/0195-6698(95)90039-X">On Product Representations of Powers, I</a>, Europ. J. Combinatorics 16 (1995), 567-588. %H A373119 P. Pach and M. Vizer, <a href="https://doi.org/10.37236/11477">Improved Lower Bounds for Multiplicative Square-Free Sequences</a>, The Electronic Journal of Combinatorics, Volume 30, Issue 4 (2023), P4.31. %H A373119 Terence Tao, <a href="https://arxiv.org/abs/2405.11610">On product representations of squares</a>, arXiv:2405.11610 [math.NT], May 2024. %e A373119 a(7)=6, because the set {1,2,3,4,5,7} has no four distinct elements multiplying to a square, but {1,2,3,4,5,6,7} has 1*2*3*6 = 6^2. %o A373119 (Python) %o A373119 from math import isqrt %o A373119 def is_square(n): %o A373119 return isqrt(n) ** 2 == n %o A373119 def valid_subset(A): %o A373119 length = len(A) %o A373119 for i in range(length): %o A373119 for j in range(i + 1, length): %o A373119 for k in range(j + 1, length): %o A373119 for l in range(k + 1, length): %o A373119 if is_square(A[i] * A[j] * A[k] * A[l]): %o A373119 return False %o A373119 return True %o A373119 def largest_subset_size(N): %o A373119 from itertools import combinations %o A373119 for size in reversed(range(1, N + 1)): %o A373119 for subset in combinations(range(1, N + 1), size): %o A373119 if valid_subset(subset): %o A373119 return size %o A373119 for N in range(1, 23): %o A373119 print(largest_subset_size(N)) %o A373119 (Python) %o A373119 from math import prod %o A373119 from functools import lru_cache %o A373119 from itertools import combinations %o A373119 from sympy.ntheory.primetest import is_square %o A373119 @lru_cache(maxsize=None) %o A373119 def A373119(n): %o A373119 if n==1: return 1 %o A373119 i = A373119(n-1)+1 %o A373119 if sum(1 for p in combinations(range(1,n),3) if is_square(n*prod(p))) > 0: %o A373119 a = [set(p) for p in combinations(range(1,n+1),4) if is_square(prod(p))] %o A373119 for q in combinations(range(1,n),i-1): %o A373119 t = set(q)|{n} %o A373119 if not any(s<=t for s in a): %o A373119 return i %o A373119 else: %o A373119 return i-1 %o A373119 else: %o A373119 return i # _Chai Wah Wu_, May 30 2024 %Y A373119 Cf. A028391, A013928, A372306, A373114, A373178, A373195. %Y A373119 Lower bounded by A000720. %K A373119 nonn %O A373119 1,2 %A A373119 _Terence Tao_, May 26 2024 %E A373119 a(22)-a(37) from _Michael S. Branicky_, May 26 2024 %E A373119 a(38)-a(63) from _Martin Ehrenstein_, May 27 2024 %E A373119 a(64)-a(69) from _Jinyuan Wang_, Dec 30 2024