login
A344093
a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is the product of two distinct primes, with a(1) = 1.
0
1, 5, 9, 6, 4, 2, 8, 7, 3, 11, 10, 12, 14, 19, 15, 18, 16, 17, 21, 13, 20, 26, 25, 30, 27, 24, 22, 29, 28, 23, 32, 33, 36, 38, 31, 34, 35, 39, 43, 42, 40, 37, 45, 41, 44, 47, 46, 48, 58, 53, 62, 49, 57, 54, 52, 59, 56, 50, 61, 68, 51, 55, 60, 63, 66, 67, 74, 69, 64
OFFSET
1,2
COMMENTS
This sequence is not to be confused with A243625 (similar but with "semiprime" instead of "product of two distinct primes"). This sequence omits squares of primes, whereas semiprimes include them. This sequence is also similar to A055625, in which sums of consecutive terms are primes instead of semiprimes.
Interestingly, the first 9 terms are a permutation of the first 9 positive integers. This is also true for the first 12, 21, 30, and 48 terms, and possibly higher values as well. This suggests that every positive integer occurs, but this is unproved.
EXAMPLE
a(4) = 6 because 6 is the smallest k such that a(3) + k is the product of two distinct primes.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=1; While[MemberQ[Array[a, n-1], k]||Last/@FactorInteger[a[n-1]+k]!={1, 1}, k++]; k); Array[a, 100] (* Giorgos Kalogeropoulos, Aug 16 2021 *)
PROG
(Python)
terms = [1]
previous = 1
def isValid(num):
counter = 0
for possibleDiv in range(1, int(math.sqrt(num)) + 1):
if num % possibleDiv == 0:
counter += 1
if num/possibleDiv % possibleDiv == 0 and possibleDiv != 1:
return False
if counter > 2:
return False
if counter == 2:
return True
return False
def generateSequence(numOfTerms):
for i in range(numOfTerms):
testNum = 1
valid = False
while not valid:
if testNum not in terms:
possibleNum = previous + testNum
if isValid(num):
valid = True
terms.append(testNum)
previous = testNum
testNum += 1
CROSSREFS
KEYWORD
nonn
AUTHOR
Atticus Stewart, Aug 15 2021
STATUS
approved