login
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

%I #11 Jan 29 2022 12:42:46

%S 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,

%T 35,32,28,34,17,36,38,19,40,39,42,44,45,46,23,48,50,52,51,54,56,49,63,

%U 55,57,58,29,60,62,31,66,64,68,65,70,72,69,74,37,75,78,76,80,77,84,81,87

%N 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.

%C This sequence shows similar behavior to the EKG sequence A064413. See the linked image.

%H Scott R. Shannon, <a href="/A349491/a349491.png">Image of the first 10000 terms</a>. The green line is y = n.

%e a(3) = 2 as a(2)*3 = 6, 2!=4, 2!=3, 2 is unused and gcd(6,2) > 1.

%e a(4) = 6 as a(3)*4 = 8, 6!=2, 6!=4, 6 is unused and gcd(8,6) > 1.

%o (Python)

%o from math import gcd

%o terms, appears = [1], {}

%o for n in range(2, 100):

%o t = 2

%o while not(appears.get(t) is None and gcd(terms[-1]*n, t)>1 and t!=terms[-1] and t!=n):

%o t += 1

%o appears[t] = True; terms.append(t);

%o print(terms) # _Gleb Ivanov_, Nov 20 2021

%Y Cf. A064413, A349493, A349472, A098550, A336957.

%K nonn

%O 1,2

%A _Scott R. Shannon_, Nov 19 2021