OFFSET
1,1
COMMENTS
This sequence is infinite, since the asymptotic density of the primes and semiprimes is 0. - Charles R Greathouse IV, Nov 12 2016
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..37 (terms < 10^13)
EXAMPLE
a(5) = 247 because the next prime or semiprime after 241 is 247, and that is a record gap of size 6.
PROG
(PARI) r=0; last=2; for(n=3, 1e9, if(bigomega(n)<3, if(n-last>r, r=n-last; print1(n", ")); last=n)) \\ Charles R Greathouse IV, Nov 12 2016
(PARI) checkrange(a, b, r)=while(b-a>r, forstep(n=a+r, a+1, -1, if(bigomega(n)<3, a=n; next(2))); for(n=a+r+1, b, if(bigomega(n)<3, return([a, n])))); 0
print1(3); p=5; r=1; forprime(q=7, 1e9, if(q-p<=r, p=q; next); t=checkrange(p, q, r); while(t!=0, print1(", "t[2]); t=checkrange(t[2], q, r=t[2]-t[1])); p=q) \\ Charles R Greathouse IV, Nov 12 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Bobby Jacobs, Nov 12 2016
EXTENSIONS
a(7)-a(31) from Charles R Greathouse IV, Nov 12 2016
STATUS
approved