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 A376198 #22 Oct 05 2024 12:38:26 %S A376198 1,2,3,4,6,8,9,10,5,7,11,12,14,15,16,18,20,21,22,24,25,26,13,17,19,23, %T A376198 27,28,30,32,33,34,35,36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56, %U A376198 57,58,29,31,37,41,43,47,53,59,60,62,63,64,65,66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88,90,91,92,93,94 %N A376198 a(1) = 1, a(2) = 2. Thereafter, let smc and smp denote the smallest missing composite and smallest missing prime. If a(n) is composite, then if a(n) = 2*smp then a(n+1) = smp, otherwise a(n+1) = smc; if a(n) is a prime, then if smp < smc, a(n+1) = smp, otherwise a(n+1) = smc. %C A376198 The composite terms appear in their natural order, as do the primes. %C A376198 This is a simplified version of A375564 (the difference being in the way the composite numbers are handled: here they appear in order, whereas in A375564 successive composite numbers must have a common gcd greater than 1). %C A376198 The following table was calculated by _Michael S. Branicky_ on Oct 04 2024. %C A376198 It shows the beginning, end, and length of the k-th run of successive primes. %C A376198 a b c : d e f [a = k, b = A376750(k), c = A376751(k), %C A376198 1 2 2 : 3 3 2 d = A376752(k), e = A376753(k), f = A376754(k)] %C A376198 2 9 5 : 11 11 3 %C A376198 3 23 13 : 26 23 4 %C A376198 4 52 29 : 59 59 8 %C A376198 5 110 61 : 122 113 13 %C A376198 6 231 127 : 254 251 24 %C A376198 7 472 257 : 514 509 43 %C A376198 8 965 521 : 1042 1039 78 %C A376198 9 1958 1049 : 2099 2099 142 %C A376198 10 3962 2111 : 4222 4219 261 %C A376198 11 7980 4229 : 8458 8447 479 %C A376198 12 16029 8461 : 16922 16921 894 %C A376198 13 32181 16927 : 33854 33851 1674 %C A376198 14 64597 33857 : 67714 67709 3118 %C A376198 15 129574 67723 : 135446 135433 5873 %C A376198 16 259798 135449 : 270899 270899 11102 %C A376198 17 520835 270913 : 541826 541817 20992 %C A376198 18 1043833 541831 : 1083662 1083659 39830 %C A376198 19 2091473 1083689 : 2167378 2167369 75906 %C A376198 20 4190135 2167393 : 4334786 4334777 144652 %C A376198 21 8392863 4334791 : 8669582 8669543 276720 %C A376198 22 16809322 8669593 : 17339186 17339177 529865 %C A376198 23 33661860 17339197 : 34678394 34678381 1016535 %C A376198 24 67402676 34678421 : 69356842 69356839 1954167 %C A376198 25 134952624 69356857 : 138713714 138713711 3761091 %C A376198 26 270177158 138713717 : 277427434 277427431 7250277 %C A376198 27 540861852 277427441 : 554854882 554854873 13993031 %C A376198 28 1082667610 554854889 : 1109709778 1109709709 27042169 %C A376198 29 2167106199 1109709791 : 2219419582 2219419577 52313384 %C A376198 30 4337519113 2219419597 : 4438839194 4438839173 101320082 %C A376198 31 8681255531 4438839259 : 8877678518 8877678499 196422988 %C A376198 32 17374202846 8877678527 : 17755357054 17755357051 381154209 %C A376198 33 34770433922 17755357069 : 35510714138 35510714137 740280217 %H A376198 Michael S. Branicky, <a href="/A376198/b376198.txt">Table of n, a(n) for n = 1..100000</a> %o A376198 (Python) %o A376198 from itertools import islice %o A376198 from sympy import isprime, nextprime %o A376198 def agen(): # generator of terms %o A376198 an, smc, smp = 2, 4, 3 %o A376198 yield from [1, 2] %o A376198 while True: %o A376198 if not isprime(an): %o A376198 an = smp if an == 2*smp else smc %o A376198 else: %o A376198 an = smp if smp < smc else smc %o A376198 if an == smp: smp = nextprime(smp) %o A376198 else: %o A376198 smc += 1 %o A376198 while isprime(smc): smc += 1 %o A376198 yield an %o A376198 print(list(islice(agen(), 87))) # _Michael S. Branicky_, Oct 03 2024 %Y A376198 Cf. A375564, A376199-A376201, A376750-A376754. %Y A376198 See also A113646 (next composite number). %K A376198 nonn %O A376198 1,2 %A A376198 _N. J. A. Sloane_, Oct 03 2024