login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A076974
Increasing sequence where each number is unequal to 2 mod all previous numbers.
3
2, 3, 7, 13, 19, 25, 31, 39, 43, 49, 55, 61, 69, 73, 81, 85, 91, 99, 103, 109, 115, 123, 129, 133, 139, 147, 151, 159, 165, 169, 175, 181, 187, 193, 199, 207, 213, 225, 229, 235, 241, 253, 259, 265, 271, 279, 283, 291, 295, 309, 313, 319, 333, 337, 349, 355
OFFSET
1,1
COMMENTS
Can be generated quickly by modified sieve of Eratosthenes. Note that eliminating numbers that equal zero mod any previous number is exactly the sieve of Eratosthenes and generates the primes; eliminating numbers that equal one mod any previous number just gives the even numbers.
Bill McEachen has observed that, except for 5, this sequence contains the larger of every pair of twin primes (A006512). This is because the larger of a pair of twin primes could only be sieved out by the smaller twin in the same pair. But except for 3, the smaller twins are all 5 mod 6 and are sieved out by 3, so they are not present in the sequence and cannot sieve out the larger twins. - David Eppstein, Jul 20 2021
EXAMPLE
a(4) = 13 because the smaller numbers after a(3) = 7 are eliminated: 8 == 2 (mod 2 or 3), 9 == 2 (mod 7), 10 == 2 (mod 2), 11 == 2 (mod 3), 12 == 2 (mod 2).
PROG
(Python)
def A076974():
D = {}
q = 2
while True:
if q not in D:
yield q
D.setdefault(q+2, []).append(q)
else:
for p in D[q]:
D.setdefault(p+q, []).append(p)
del D[q]
q += 1
a = A076974(); print([next(a) for _ in range(100)])
(Haskell)
a076974 n = a076974_list !! (n-1)
a076974_list = 2 : s [3, 5 ..] where
s (x:xs) = x : s [z | z <- xs, mod z x /= 2]
-- Reinhard Zumkeller, Feb 28 2014
CROSSREFS
Cf. A006512.
Sequence in context: A130903 A068828 A100764 * A051484 A101415 A210393
KEYWORD
easy,nonn
AUTHOR
David Eppstein, Nov 28 2002
EXTENSIONS
Offset changed by Reinhard Zumkeller, Feb 28 2014
STATUS
approved