login
A349491
a(1)=1, a(2)=4; for n > 2, a(n) is the smallest unused positive number such that gcd(a(n-1)*n,a(n)) > 1, where a(n) != a(n-1) and a(n) != n.
1
1, 4, 2, 6, 3, 8, 10, 5, 12, 9, 15, 14, 7, 16, 18, 20, 22, 11, 33, 21, 24, 26, 13, 27, 30, 25, 35, 32, 28, 34, 17, 36, 38, 19, 40, 39, 42, 44, 45, 46, 23, 48, 50, 52, 51, 54, 56, 49, 63, 55, 57, 58, 29, 60, 62, 31, 66, 64, 68, 65, 70, 72, 69, 74, 37, 75, 78, 76, 80, 77, 84, 81, 87
OFFSET
1,2
COMMENTS
This sequence shows similar behavior to the EKG sequence A064413. See the linked image.
LINKS
Scott R. Shannon, Image of the first 10000 terms. The green line is y = n.
EXAMPLE
a(3) = 2 as a(2)*3 = 6, 2!=4, 2!=3, 2 is unused and gcd(6,2) > 1.
a(4) = 6 as a(3)*4 = 8, 6!=2, 6!=4, 6 is unused and gcd(8,6) > 1.
PROG
(Python)
from math import gcd
terms, appears = [1], {}
for n in range(2, 100):
t = 2
while not(appears.get(t) is None and gcd(terms[-1]*n, t)>1 and t!=terms[-1] and t!=n):
t += 1
appears[t] = True; terms.append(t);
print(terms) # Gleb Ivanov, Nov 20 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 19 2021
STATUS
approved