login
A389839
Smallest even number which cannot be written as the difference of two consecutive numbers which are relatively prime to the primorial prime(n)#.
1
6, 8, 12, 16, 20, 28, 32, 42, 48, 60, 68
OFFSET
2,1
COMMENTS
By symmetry (since x is relatively prime to prime(n)# if and only if prime(n)# - x is), periodicity modulo prime(n)#, and the fact that prime(n)#/2 - 2 is relatively prime to prime(n)#, it is sufficient to check only the numbers relatively prime to prime(n)# that are bounded by prime(n)#/2 + 2, when starting from -1 (to also account for the difference between k*prime(n)# - 1 and k*prime(n)# + 1).
LINKS
Thomas Bloom, Problem 854, Erdős Problems.
FORMULA
a(n) <= 2*(A329815(n)+1) for n >= 3. - Jamie Morken, Dec 18 2025
EXAMPLE
For n=3, a(3)=8 since since the numbers relatively prime to and bounded by prime(3)# = 30 are in the set {1, 7, 11, 13, 17, 19, 23, 29}. The consecutive differences are 6,4,2,4,2,4,6,2 (which then repeat). Hence 2 (also appears as 31-29), 4 and 6 do appear, but 8 does not, so a(3)=8.
For n=6, the differences that do appear are {2, 4, 6, 8, 10, 12, 14, 16, 18, 22}. Hence 20 is the smallest even difference not appearing.
PROG
(SageMath)
def a(n):
N=prod(Primes()[0:n])
R=[a for a in range(-1, ceil(N/2)+3, 2) if gcd(N, a)==1]
A=set([R[i]-R[i-1] for i in range(1, len(R))])
i=2
while i in A:
i+=2;
return i
(Python)
from math import gcd
from sympy import primorial
def A389839(n):
c, s, q, p = 0, {0}, -1, primorial(n)
for i in range(1, (p>>1)+3, 2):
if gcd(p, i) == 1:
r = i-q
if r not in s:
s.add(r)
while c in s:
c += 2
q = i
return c # Chai Wah Wu, Oct 29 2025
KEYWORD
nonn,more
AUTHOR
Stijn Cambie, Oct 16 2025
EXTENSIONS
a(10) from Andrew Howroyd, Oct 16 2025
a(11) from Chai Wah Wu, Oct 29 2025
a(12) from Chai Wah Wu, Nov 03 2025
STATUS
approved