cp's OEIS Frontend

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.

A370998 2*a(n) = m is the least even number m such that all sums m + prime(k), k=1..n are composite.

This page as a plain text file.
%I A370998 #17 Mar 11 2025 03:00:22
%S A370998 1,3,11,44,44,56,56,101,101,101,359,359,359,664,664,821,821,821,866,
%T A370998 866,866,2623,2623,2623,2623,2944,2944,2944,2944,2944,2944,2944,2944,
%U A370998 2944,5171,5171,12839,18833,18833,18833,18833,29947,29947,29947,38002,38002,38002,38002,51551
%N A370998 2*a(n) = m is the least even number m such that all sums m + prime(k), k=1..n are composite.
%H A370998 Robert Israel, <a href="/A370998/b370998.txt">Table of n, a(n) for n = 1..273</a>
%e A370998 a(1) = 1: prime(1) = 2; 2 + 2*a(1) = 4 is the first composite.
%e A370998 a(2) = 3: m = 6; since all sums prime(1) + 2*x are even, any x can be chosen. prime(2) = 3, 3 + 6 = 9, whereas 3 + 1*2 and 3 + 2*2 are prime.
%e A370998 a(3) = 11: m = 22; for any even m < 22 at least one of 3 + m or 5 + m would be prime, e.g., 3+2=5, 3+4=7, 5+6=11, 3+8=11, 5+12=17, 5+14=19, 3+16=19, 5+18=23, 3+20=23, but 3+22=25 and 5+22 are composite.
%p A370998 R:= 1: P:= [2]: r:= 1:
%p A370998 for n from 2 to 100 do
%p A370998   P:= [op(P), ithprime(n)];
%p A370998   for k from r while ormap(isprime,P +~ 2*k) do od:
%p A370998   R:= R, k; r:= k;
%p A370998 od:
%p A370998 R; # _Robert Israel_, Mar 09 2025
%o A370998 (Python)
%o A370998 from itertools import count
%o A370998 from sympy import prime, isprime
%o A370998 def A370998(n):
%o A370998     ptuple = tuple(prime(k) for k in range(1,n+1))
%o A370998     return next(filter(lambda m:not any(isprime(p+m) for p in ptuple),count(2,2)))>>1 # _Chai Wah Wu_, Mar 21 2024
%Y A370998 Cf. A239392 (records).
%K A370998 nonn
%O A370998 1,2
%A A370998 _Hugo Pfoertner_, Mar 09 2024