[go: up one dir, main page]

login
Smallest prime p such that p == n (mod prime(n)).
4

%I #28 Sep 08 2022 08:45:55

%S 3,2,3,11,5,19,7,103,101,97,11,197,13,229,109,281,17,79,19,233,167,

%T 101,23,113,607,127,233,349,29,821,31,163,307,173,631,1093,37,853,373,

%U 1597,41,223,43,1009,439,643,47,271,503,2111,983,769,53,1811,569,2423

%N Smallest prime p such that p == n (mod prime(n)).

%C a(n) = n iff n is prime.

%H Zak Seidov, <a href="/A186102/b186102.txt">Table of n, a(n) for n = 1..10000</a>

%e Eighth prime is 19, and 103 is the smallest prime p such that p mod 19 is 8. Therefore a(8) = 103.

%t k=200;Table[p=Prime[n];m=n;While[!PrimeQ[m],m=m+p];m,{n,k}]; (* For the first k terms. _Zak Seidov_, Dec 13 2013 *)

%t Flatten[With[{prs=Prime[Range[500]]},Table[Select[prs,Mod[#,Prime[n]] == n&,1],{n,60}]]] (* _Harvey P. Dale_, Mar 30 2012 *)

%o (Magma) Aux:=function(n); q:=NthPrime(n); p:=2; while p mod q ne n do p:=NextPrime(p); end while; return p; end function; [ Aux(n): n in [1..70] ]; // _Klaus Brockhaus_, Feb 12 2011

%o (Sage) def A186102(n): np = nth_prime(n); return next(p for p in Primes() if p % np == n) # [_D. S. McNeil_, Feb 13 2011]

%o (Haskell)

%o a186102 n = f a000040_list where

%o f (q:qs) = if (q - n) `mod` (a000040 n) == 0 then q else f qs

%o -- _Reinhard Zumkeller_, Aug 21 2015

%Y Cf. A061067, A061068, A064402, A076297, A076298, A076299, A076300.

%Y Cf. A000040, A260416.

%K nonn

%O 1,1

%A _Zak Seidov_, Feb 12 2011