login
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.
12
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, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 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
OFFSET
1,2
COMMENTS
The composite terms appear in their natural order, as do the primes.
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).
The following table was calculated by Michael S. Branicky on Oct 04 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 = A376750(k), c = A376751(k),
1 2 2 : 3 3 2 d = A376752(k), e = A376753(k), f = A376754(k)]
2 9 5 : 11 11 3
3 23 13 : 26 23 4
4 52 29 : 59 59 8
5 110 61 : 122 113 13
6 231 127 : 254 251 24
7 472 257 : 514 509 43
8 965 521 : 1042 1039 78
9 1958 1049 : 2099 2099 142
10 3962 2111 : 4222 4219 261
11 7980 4229 : 8458 8447 479
12 16029 8461 : 16922 16921 894
13 32181 16927 : 33854 33851 1674
14 64597 33857 : 67714 67709 3118
15 129574 67723 : 135446 135433 5873
16 259798 135449 : 270899 270899 11102
17 520835 270913 : 541826 541817 20992
18 1043833 541831 : 1083662 1083659 39830
19 2091473 1083689 : 2167378 2167369 75906
20 4190135 2167393 : 4334786 4334777 144652
21 8392863 4334791 : 8669582 8669543 276720
22 16809322 8669593 : 17339186 17339177 529865
23 33661860 17339197 : 34678394 34678381 1016535
24 67402676 34678421 : 69356842 69356839 1954167
25 134952624 69356857 : 138713714 138713711 3761091
26 270177158 138713717 : 277427434 277427431 7250277
27 540861852 277427441 : 554854882 554854873 13993031
28 1082667610 554854889 : 1109709778 1109709709 27042169
29 2167106199 1109709791 : 2219419582 2219419577 52313384
30 4337519113 2219419597 : 4438839194 4438839173 101320082
31 8681255531 4438839259 : 8877678518 8877678499 196422988
32 17374202846 8877678527 : 17755357054 17755357051 381154209
33 34770433922 17755357069 : 35510714138 35510714137 740280217
LINKS
PROG
(Python)
from itertools import islice
from sympy import isprime, nextprime
def agen(): # generator of terms
an, smc, smp = 2, 4, 3
yield from [1, 2]
while True:
if not isprime(an):
an = smp if an == 2*smp else smc
else:
an = smp if smp < smc else smc
if an == smp: smp = nextprime(smp)
else:
smc += 1
while isprime(smc): smc += 1
yield an
print(list(islice(agen(), 87))) # Michael S. Branicky, Oct 03 2024
CROSSREFS
See also A113646 (next composite number).
Sequence in context: A067118 A320503 A138561 * A333841 A231236 A346131
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 03 2024
STATUS
approved