The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A093868 Smallest prime that differs from a multiple of n by unity. 5
2, 3, 2, 3, 11, 5, 13, 7, 17, 11, 23, 11, 53, 13, 29, 17, 67, 17, 37, 19, 41, 23, 47, 23, 101, 53, 53, 29, 59, 29, 61, 31, 67, 67, 71, 37, 73, 37, 79, 41, 83, 41, 173, 43, 89, 47, 281, 47, 97, 101, 101, 53, 107, 53, 109, 113, 113, 59, 353, 59, 367, 61, 127, 127, 131, 67, 269 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Numbers n such that a(n-1)=a(n+1)=n are A025584 (primes p such that p-2 is not a prime). - Rick L. Shepherd, Aug 23 2004
LINKS
FORMULA
a(n) = min(A034694(n), A038700(n)) for all n >= 1. - Rick L. Shepherd, Aug 23 2004
MAPLE
f:= proc(n) local j, k;
for k from 1 do
for j in [-1, 1] do
if isprime(k*n+j) then return k*n+j fi
od od
end proc:
map(f, [$1..100]); # Robert Israel, Nov 07 2019
MATHEMATICA
a[n_] := Module[{p}, For[p = 2, True, p = NextPrime[p], If[Divisible[p-1, n] || Divisible[p+1, n], Return[p]]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 04 2023 *)
PROG
(PARI) a(n) = forprime(p=2, , if (!((p+1) % n) || !((p-1) % n), return (p))); \\ Michel Marcus, Aug 08 2014
CROSSREFS
Cf. A093869.
Cf. A034694 (Smallest prime == 1 (mod n)), A038700 (Smallest prime == -1 (mod n)).
Sequence in context: A264766 A251090 A078331 * A194603 A183465 A223168
KEYWORD
nonn,look
AUTHOR
Amarnath Murthy, Apr 20 2004
EXTENSIONS
More terms from Rick L. Shepherd, Aug 23 2004
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 May 22 04:07 EDT 2024. Contains 372742 sequences. (Running on oeis4.)