A375564 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive number that is coprime to a(n-1) if a(n-1) is prime, otherwise a(n) shares a factor with a(n-1).
1, 2, 3, 4, 6, 8, 10, 5, 7, 9, 12, 14, 16, 18, 15, 20, 22, 11, 13, 17, 19, 21, 24, 26, 28, 30, 25, 35, 40, 32, 34, 36, 27, 33, 39, 42, 38, 44, 46, 23, 29, 31, 37, 41, 43, 45, 48, 50, 52, 54, 51, 57, 60, 55, 65, 70, 49, 56, 58, 62, 64, 66, 63, 69, 72, 68, 74, 76, 78, 75, 80, 82, 84, 77, 88, 86, 90
Offset: 1
Keywords
Examples
a(8) = 7 as a(7) = 5 is a prime number, and 7 is the smallest unused number that is coprime to 5. Comment from _N. J. A. Sloane_, Oct 02 2024 (Start) The following table was calculated by _Scott R. Shannon_ on Sep 29 2024. It shows the beginning, end, and length of the k-th run of successive primes. a b c : d e f [a = k, b = A376192(k), c = A376193(k), 1 2 2 : 3 3 2 d = A376196, e = A376197, f = A376195] 2 8 5 : 9 7 2 3 18 11 : 21 19 4 4 40 23 : 45 43 6 5 84 47 : 92 83 9 6 162 89 : 177 167 16 7 321 173 : 351 349 31 8 649 353 : 702 683 54 9 1286 691 : 1379 1361 94 10 2550 1367 : 2724 2699 175 11 5096 2707 : 5412 5387 317 12 10188 5393 : 10787 10739 600 13 20406 10753 : 21502 21467 1097 14 40883 21481 : 42958 42863 2076 15 81932 42899 : 85791 85717 3860 16 164190 85733 : 171441 171103 7252 17 328490 171131 : 342216 341729 13727 18 657509 341743 : 683462 682811 25954 19 1316258 682819 : 1365580 1364747 49323 20 2635513 1364761 : 2729447 2728129 93935 21 5276876 2728163 : 5456194 5454167 179319 22 10565366 5454181 : 10908253 10906271 342888 23 21155215 10906297 : 21812343 21808453 657129 24 42355195 21808483 : 43616683 43611721 1261489 25 84797387 43611731 : 87223016 87215467 2425630 26 169759097 87215483 : 174430392 174419101 4671296 (End)
Links
- Scott R. Shannon, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^16, with a color function showing primes in red, perfect powers of primes in gold, squarefree composites in green, and numbers neither squarefree nor prime powers in blue and purple, with purple additionally representing powerful numbers that are not prime powers.
- Scott R. Shannon, Image of the first 100000 terms. The terms are colored red, yellow, green, blue, violet if they have one, two, three, four, or five or more prime factors. The thin white line is a(n) = n.
- Scott R. Shannon, Image of the first 25 million terms [Conventions as in preceding image.]
- N. J. A. Sloane, Proof that this sequence is a permutation of the positive integers
- N. J. A. Sloane, Table of n, a(n) for n = 1..100000
- N. J. A. Sloane, A Nasty Surprise in a Sequence and Other OEIS Stories, Experimental Mathematics Seminar, Rutgers University, Oct 10 2024, Youtube video; Slides [Mentions this sequence]
Crossrefs
Programs
-
Mathematica
nn = 120; c[_] := False; Do[Set[{a[i], c[i]}, {i, True}], {i, 2}]; j = a[2]; u = 3; Do[k = u; If[PrimeQ[j], While[Or[c[k], GCD[j, k] > 1], k++], While[Or[c[k], CoprimeQ[j, k]], k++]]; Set[{a[i], c[k], j}, {k, True, k}]; If[k == u, While[c[u], u++]], {i, 3, nn}]; Array[a, nn] (* Michael De Vlieger, Sep 29 2024 *)
-
Python
from itertools import islice from math import gcd from sympy import isprime def A375564_gen(): # generator of terms aset, a, b = {1,2}, 2, 3 yield from (1,2) while True: c = b if isprime(a): while c in aset or gcd(c,a)>1: c+=1 else: while c in aset or gcd(c,a)==1: c+=1 aset.add(c) yield (a:=c) while b in aset: b += 1 A375564_list = list(islice(A375564_gen(),20)) # Chai Wah Wu, Sep 30 2024
Comments