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!)
A039731 a(n) = max{prime(n) mod q, where prime q < prime(n) = n-th prime}. 3
1, 2, 2, 4, 6, 6, 8, 10, 12, 14, 18, 18, 20, 18, 24, 28, 30, 30, 34, 36, 38, 40, 42, 44, 48, 50, 48, 50, 54, 60, 64, 66, 68, 70, 72, 78, 80, 78, 84, 82, 84, 94, 96, 96, 98, 104, 110, 100, 102, 106, 112, 114, 124, 126, 126, 132, 134, 138, 132, 134, 144, 150 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,2
COMMENTS
Sequence lists the maxima of rows of triangle A207409. - Michel Marcus, Oct 01 2013
If there is a prime q with p/2 < q < 2p/3, then p mod q = p - q and a(n) = p - nextprime(p/2). But by a result of Nagura, there is always a prime between x and 6x/5 for x > 25, so this holds for all p > 50 and (checking 2 <= n <= 15) for all n > 1. - Charles R Greathouse IV, Jul 12 2024
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 2..10000
Jitsuro Nagura, On the interval containing at least one prime number, Proc. Japan Acad. 28: 177-181, 1952.
FORMULA
a(n) = p - nextprime(p/2), where p is the n-th prime, see Greathouse comment. - Charles R Greathouse IV, Jul 12 2024
MAPLE
a := proc(n) ithprime(n); % - nextprime(iquo(%, 2)) end: seq(a(n), n = 2..63);
# Peter Luschny, Jul 13 2024 (after Charles R Greathouse IV)
MATHEMATICA
Map[# - NextPrime[#/2] &, Prime[Range[2, 100]]] (* Paolo Xausa, Jul 15 2024, after Charles R Greathouse IV *)
PROG
(PARI) a(n)=maxp = 0; for (i = 1, n-1, mp = prime(n) % prime(i); maxp = max(mp, maxp); ); maxp; \\ Michel Marcus, Oct 01 2013
(PARI) P=primes(100); vector(#P, i, mx=0; for(j=1, i-1, mx=max(P[i]%P[j], mx)); mx)[2..#P] \\ Charles R Greathouse IV, Oct 01 2013
(PARI) a(n) = my(p=prime(n)); p - nextprime(p/2) \\ Charles R Greathouse IV, Jul 12 2024
CROSSREFS
Sequence in context: A178883 A109832 A309075 * A005341 A137268 A008130
KEYWORD
nonn,easy,changed
AUTHOR
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 July 26 19:11 EDT 2024. Contains 374636 sequences. (Running on oeis4.)