login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342068 a(n) is the smallest k > 1 such that there are more primes in the interval [(k-1)*n + 1, k*n] than there are in the interval [(k-2)*n + 1, (k-1)*n]. 6
2, 6, 10, 5, 3, 7, 5, 3, 5, 5, 7, 4, 11, 3, 5, 5, 7, 3, 4, 3, 7, 4, 5, 5, 5, 6, 6, 9, 3, 6, 8, 4, 6, 5, 7, 5, 5, 6, 5, 5, 7, 4, 9, 6, 4, 10, 3, 3, 4, 4, 7, 4, 6, 4, 5, 5, 4, 5, 4, 8, 6, 7, 7, 5, 10, 6, 3, 3, 6, 4, 4, 4, 4, 4, 4, 9, 8, 6, 6, 6, 3, 5, 6, 5, 6, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(519) is a noteworthy record high value; a(n) < 13 for all n < 519, and a(n) < 19 for all n < 9363 except that a(519)=19.
LINKS
EXAMPLE
The 1st 100 positive integers, 1..100, include 25 primes;
the 2nd 100 positive integers, 101..200, include 21 primes;
the 3rd 100 positive integers, 201..300, include 16 primes;
the 4th 100 positive integers, 301..400, include 16 primes;
the 5th 100 positive integers, 401..500, include 17 primes.
The sequence 25, 21, 16, 16, 17, is nonincreasing until we reach the 5th term, 17, so a(100) = 5.
Considering the positive integers in consecutive intervals of length 519, instead (i.e., [1,519], [2,1038], [3,1557], ...) and counting the primes in each interval, we get a sequence that is nonincreasing until we reach the 19th term, since the 19th interval, [9343,9861], contains more primes than does the 18th, so a(519)=19.
MAPLE
a:= proc(n) uses numtheory; local i, j, k; i:= n;
for k do j:= pi(k*n)-pi((k-1)*n);
if j>i then break else i:=j fi
od; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Mar 21 2021
MATHEMATICA
a[n_] := Module[{i = n, j, k},
For[k = 1, True, k++, j = PrimePi[k*n] - PrimePi[(k-1)*n];
If[j > i, Break[], i = j]]; k];
Array[a, 100] (* Jean-François Alcover, Jul 01 2021, after Alois P. Heinz *)
PROG
(Python)
from sympy import primepi
def A342068(n):
k, a, b, c = 2, 0, primepi(n), primepi(2*n)
while a+c <= 2*b:
k += 1
a, b, c = b, c, primepi(k*n)
return k # Chai Wah Wu, Mar 25 2021
CROSSREFS
Sequence in context: A320383 A073662 A086553 * A004055 A077933 A144762
KEYWORD
nonn
AUTHOR
Jon E. Schoenfield, Mar 21 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 06:39 EDT 2024. Contains 371920 sequences. (Running on oeis4.)