A093714 a(n) = smallest number coprime to a(n-1), not equal to a(n-1)+1, and not occurring earlier; a(1)=1.
1, 3, 2, 5, 4, 7, 6, 11, 8, 13, 9, 14, 17, 10, 19, 12, 23, 15, 22, 21, 16, 25, 18, 29, 20, 27, 26, 31, 24, 35, 32, 37, 28, 33, 38, 41, 30, 43, 34, 39, 44, 47, 36, 49, 40, 51, 46, 45, 52, 55, 42, 53, 48, 59, 50, 57, 56, 61, 54, 65, 58, 63, 62, 67, 60, 71, 64, 69, 68, 73, 66, 79
Offset: 1
Keywords
Links
Crossrefs
Programs
-
Mathematica
nn = 120; c[] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; While[Nand[c[k] == 0, CoprimeQ[#, k], k != # + 1], k++] &@ a[i - 1]; Set[{a[i], c[k]}, {k, i}]; If[a[i] == u, While[c[u] > 0, u++]], {i, 2, nn}]; Array[a, nn] (* _Michael De Vlieger, May 02 2022 *)
-
Python
from math import gcd from itertools import islice def agen(): # generator of terms an, aset, mink = 1, {1}, 2 while True: yield an k = mink while k in aset or gcd(an, k) != 1 or k-an == 1: k += 1 an = k aset.add(an) while mink in aset: mink += 1 print(list(islice(agen(), 72))) # Michael S. Branicky, May 02 2022
Comments