%I #15 Feb 21 2024 10:31:48
%S 1,2,3,4,5,7,6,11,8,13,9,10,17,12,19,14,15,22,21,20,23,16,27,25,24,29,
%T 18,31,26,33,28,37,30,41,32,43,34,35,46,39,38,45,44,47,36,53,40,49,48,
%U 55,52,51,56,57,58,59,42,61,50,63,62,67,54,65,71,60,73,64,75,68,69,76,77,79,66,83,70
%N a(1) = 1; for n > 1, a(n) is smallest unused number such that a(n) is coprime to a(n-1) and sopfr(a(n)) is coprime to sopfr(a(n-1)), where sopfr(k) is the sum of the primes dividing k, with repetition.
%C In the first 100000 terms the primes appear in their natural order. In the same range the fixed points begin 1, 2, 3, 4, 5, 20, 134, 136, 403, 598, 608, 649, 667. The sequence is conjectured to be a permutation of the positive numbers.
%H Scott R. Shannon, <a href="/A370496/b370496.txt">Table of n, a(n) for n = 1..10000</a>
%e a(9) = 8 as a(8) = 11 and 8 is the smallest unused number that is coprime to 11, while sopfr(8) = 6 is coprime to sopfr(11) = 11.
%o (Python)
%o from math import gcd
%o from sympy import factorint
%o from functools import cache
%o from itertools import count, islice
%o @cache
%o def sopfr(n): return sum(p*e for p,e in factorint(n).items())
%o def agen(): # generator of terms
%o yield 1
%o aset, an, mink = {1, 2}, 2, 3
%o while True:
%o yield an
%o s = sopfr(an)
%o an = next(k for k in count(mink) if k not in aset and gcd(k, an)==1 and gcd(sopfr(k), s)==1)
%o aset.add(an)
%o while mink in aset: mink += 1
%o print(list(islice(agen(), 77))) # _Michael S. Branicky_, Feb 21 2024
%Y Cf. A001414, A370047, A370497, A064413, A277272, A027748.
%K nonn
%O 1,2
%A _Scott R. Shannon_, Feb 20 2024