This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A375564 #53 Oct 21 2024 00:05:37 %S A375564 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, %T A375564 25,35,40,32,34,36,27,33,39,42,38,44,46,23,29,31,37,41,43,45,48,50,52, %U A375564 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 %N 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). %C A375564 The sequence contains groups of consecutive primes separated by groups of composite terms. See the attached images of the first 100000 and 25 million terms. %C A375564 The fixed points are 1, 2, 3, 4, 15, 51, 63, 363, 437, ... There are thirty-two fixed points in the first 100000 terms and it is likely there are infinitely many in total. The sequence is conjectured to be a permutation of the positive integers. %C A375564 Theorem: This sequence is a permutation of the positive integers, and the primes appear in their natural order. See link for proof. - _N. J. A. Sloane_, Sep 24 2024 and Oct 02 2024 %H A375564 Scott R. Shannon, <a href="/A375564/b375564.txt">Table of n, a(n) for n = 1..10000</a> %H A375564 Michael De Vlieger, <a href="/A375564/a375564_1.png">Log log scatterplot of a(n)</a>, 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. %H A375564 Scott R. Shannon, <a href="/A375564/a375564.png">Image of the first 100000 terms</a>. 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. %H A375564 Scott R. Shannon, <a href="/A375564/a375564_2.png">Image of the first 25 million terms</a> [Conventions as in preceding image.] %H A375564 N. J. A. Sloane, <a href="/A375564/a375564.txt">Proof that this sequence is a permutation of the positive integers</a> %H A375564 N. J. A. Sloane, <a href="/A375564/a375564_2.txt">Table of n, a(n) for n = 1..100000</a> %H A375564 N. J. A. Sloane, <a href="https://www.youtube.com/watch?v=3RAYoaKMckM">A Nasty Surprise in a Sequence and Other OEIS Stories</a>, Experimental Mathematics Seminar, Rutgers University, Oct 10 2024, Youtube video; <a href="https://sites.math.rutgers.edu/~zeilberg/expmath/sloane85BD.pdf">Slides</a> [Mentions this sequence] %e A375564 a(8) = 7 as a(7) = 5 is a prime number, and 7 is the smallest unused number that is coprime to 5. %e A375564 Comment from _N. J. A. Sloane_, Oct 02 2024 (Start) %e A375564 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. %e A375564 a b c : d e f [a = k, b = A376192(k), c = A376193(k), %e A375564 1 2 2 : 3 3 2 d = A376196, e = A376197, f = A376195] %e A375564 2 8 5 : 9 7 2 %e A375564 3 18 11 : 21 19 4 %e A375564 4 40 23 : 45 43 6 %e A375564 5 84 47 : 92 83 9 %e A375564 6 162 89 : 177 167 16 %e A375564 7 321 173 : 351 349 31 %e A375564 8 649 353 : 702 683 54 %e A375564 9 1286 691 : 1379 1361 94 %e A375564 10 2550 1367 : 2724 2699 175 %e A375564 11 5096 2707 : 5412 5387 317 %e A375564 12 10188 5393 : 10787 10739 600 %e A375564 13 20406 10753 : 21502 21467 1097 %e A375564 14 40883 21481 : 42958 42863 2076 %e A375564 15 81932 42899 : 85791 85717 3860 %e A375564 16 164190 85733 : 171441 171103 7252 %e A375564 17 328490 171131 : 342216 341729 13727 %e A375564 18 657509 341743 : 683462 682811 25954 %e A375564 19 1316258 682819 : 1365580 1364747 49323 %e A375564 20 2635513 1364761 : 2729447 2728129 93935 %e A375564 21 5276876 2728163 : 5456194 5454167 179319 %e A375564 22 10565366 5454181 : 10908253 10906271 342888 %e A375564 23 21155215 10906297 : 21812343 21808453 657129 %e A375564 24 42355195 21808483 : 43616683 43611721 1261489 %e A375564 25 84797387 43611731 : 87223016 87215467 2425630 %e A375564 26 169759097 87215483 : 174430392 174419101 4671296 %e A375564 (End) %t A375564 nn = 120; c[_] := False; Do[Set[{a[i], c[i]}, {i, True}], {i, 2}]; %t A375564 j = a[2]; u = 3; %t A375564 Do[k = u; If[PrimeQ[j], %t A375564 While[Or[c[k], GCD[j, k] > 1], k++], %t A375564 While[Or[c[k], CoprimeQ[j, k]], k++]]; %t A375564 Set[{a[i], c[k], j}, {k, True, k}]; %t A375564 If[k == u, While[c[u], u++]], {i, 3, nn}]; %t A375564 Array[a, nn] (* _Michael De Vlieger_, Sep 29 2024 *) %o A375564 (Python) %o A375564 from itertools import islice %o A375564 from math import gcd %o A375564 from sympy import isprime %o A375564 def A375564_gen(): # generator of terms %o A375564 aset, a, b = {1,2}, 2, 3 %o A375564 yield from (1,2) %o A375564 while True: %o A375564 c = b %o A375564 if isprime(a): %o A375564 while c in aset or gcd(c,a)>1: %o A375564 c+=1 %o A375564 else: %o A375564 while c in aset or gcd(c,a)==1: %o A375564 c+=1 %o A375564 aset.add(c) %o A375564 yield (a:=c) %o A375564 while b in aset: %o A375564 b += 1 %o A375564 A375564_list = list(islice(A375564_gen(),20)) # _Chai Wah Wu_, Sep 30 2024 %Y A375564 Cf. A375563, A064413, A000040, A373546, A373545. %Y A375564 See also A376189, A376191-A376197, A376584. %K A375564 nonn %O A375564 1,2 %A A375564 _Scott R. Shannon_, Aug 19 2024