OFFSET
1,1
COMMENTS
The condition that e is composite and at least 6 is necessary to have 1<=a<b<c<d<e with a!b!c!d!e! a perfect square. [Erdős-Graham]
Multiples of 2, 3, 5, 7, or 11 are not in this sequence, due to identities such as 11! (7m-1)! (7m)! (11m-1)! (11m)! always being a perfect square [Erdős-Graham, Fact 7]
Is a subsequence of A005117 [Erdős-Graham]
Almost all numbers 13p with p prime lie in the sequence [Erdős-Graham, Theorem 3]
Conjectured to have positive (lower) density [Erdős-Graham]; see also Erdos problem #374. Also conjectured that almost all elements of A001358 lie in this sequence. [Erdős-Graham]
The set F_5 in [Erdős-Graham] consists of the complement of the union of this sequence and A000040.
Is somewhat difficult to compute this sequence efficiently by pure brute force; some optimization is required
What is the smallest non-semiprime term? - Chai Wah Wu, Sep 25 2025
d >= A007917(e). - David A. Corneth, Sep 26 2025
a < A151799(e). Conjecture: There exists c such that c < A151799(e). Conjecture is true for e <= 9469. - Chai Wah Wu, Sep 26 2025
First non-semiprime term is a(922) = 16523 = 13*31*41. - Chai Wah Wu, Oct 06 2025
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..1340
Thomas Bloom, Problem 374, Erdős Problems.
P. Erdős and R. L. Graham, On products of factorials, Bull. Inst. Math. Acad. Sinica 4 (1976), pp. 337-355.
P. Erdős and R. L. Graham, Old and new problems and results in combinatorial number theory, Monographies de L'Enseignement Mathématique (1980).
EXAMPLE
The first element is 527. [Erdős-Graham, Fact 14]
PROG
(Python) import sympy as sp
import numpy as np
N = 1600
primes = list(sp.primerange(2, N+1))
table = np.zeros((N+1, len(primes)), dtype=np.uint8)
for n in range(2, N+1):
factors = sp.factorint(n)
for j, p in enumerate(primes):
if p in factors:
table[n, j] = factors[p] % 2
def test(e): # assumes 6 < e <= N
fac1 = np.zeros(len(primes), dtype=np.uint8)
for d in reversed(range(1, e)):
if d+1 in primes:
return False
fac1 += table[d+1]
for c in reversed(range(1, d)):
fac2 = fac1 % 2
for b in reversed(range(1, c)):
if b+1 in primes:
if fac1[primes.index(b+1)] == 0:
break
fac2 += table[b+1]
fac3 = fac2 % 2
for a in range(1, b):
fac3 += table[a]
if np.all(fac3 % 2 == 0):
return True
return False
(Python)
from math import prod
from itertools import count, islice
from sympy import factorint, isprime
def A389148_gen(): # generator of terms
g, p, r = [set()], 0, {}
for c in count(2):
f = factorint(c)
d = g[-1]^set(i for i, j in f.items() if j&1)
for h in g:
if (t:=prod(d^h)) not in r:
r[t] = c-1
g.append(d)
if isprime(c):
p = c-2
elif any(not c%q for q in (2, 3, 5, 7, 11)):
continue
elif max(f.values())>1:
continue
else:
for b in range(c-2, p, -1):
u = d^g[b]
for a in range(b-1, 1, -1):
e = prod(u^g[a])
if e in r and r[e]<a:
break
else:
continue
break
else:
yield c
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Terence Tao, Sep 24 2025
EXTENSIONS
a(18) onwards from Chai Wah Wu, Sep 25 2025
STATUS
approved
