A085229 Smallest number which is coprime to n and to a(n-1), and is not yet in the sequence; a(1)=1.
1, 3, 2, 5, 4, 7, 6, 11, 8, 9, 10, 13, 12, 17, 14, 15, 16, 19, 18, 23, 20, 21, 22, 25, 24, 29, 26, 27, 28, 31, 30, 37, 32, 33, 34, 35, 36, 41, 38, 39, 40, 43, 42, 47, 44, 45, 46, 49, 48, 53, 50, 51, 52, 55, 54, 59, 56, 57, 58, 61, 60, 67, 62, 63, 64, 65, 66, 71, 68
Offset: 1
Keywords
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Annotated log-log scatterplot of a(n) for n = 1..256, showing records in red, local minima in blue, and highlighting fixed points in amber and primes in green.
- Amit Kumar Basistha and Eugen J. Ionascu, A special sequence and primorial numbers, arXiv:2302.02838 [math.NT], 2023.
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Mathematica
nn = 10000; c[] = 0; a[1] = c[1] = 1; a[2] = 3; c[3] = u = 2; Do[k = u; While[Nand[c[k] == 0, CoprimeQ[a[i-1], k]], k++]; Set[{a[i], c[k]}, {k, i}]; If[a[i] == u, While[c[u] > 0, u++]], {i, 3, nn}]; Array[a, nn] (* _Michael De Vlieger, Apr 13 2022 *)
-
Python
from math import gcd from itertools import count, islice def agen(): # generator of terms an, aset = 1, {1} for n in count(2): yield an k = 1 while k in aset or any(gcd(t, k) != 1 for t in [n, an]): k+= 1 aset.add(k) an = k print(list(islice(agen(), 69))) # Michael S. Branicky, Apr 13 2022
Comments