login
Least k > 0 such that prime(n+k) == k (mod prime(n)).
2

%I #8 Oct 27 2017 21:58:35

%S 1,4,3,3,8,5,47,30,7,9,9,20,81,11,13,135,52,15,17,47,17,51,141,207,78,

%T 152,23,160,67,147,142,102,398,29,62,212,91,151,443,758,70,70,39,318,

%U 39,76,280,327,125,267,434,166,88,1261,369,98,307,98,724,358,53,104,59,681,112,159,410,371,1007

%N Least k > 0 such that prime(n+k) == k (mod prime(n)).

%H Robert Israel, <a href="/A105342/b105342.txt">Table of n, a(n) for n = 1..10000</a>

%p f:= proc(n) local p,k;

%p p:= ithprime(n);

%p for k from 1 do if ithprime(n+k) - k mod p = 0 then return k fi

%p od:

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Oct 27 2017

%t bb={};Do[Do[If[k==Mod[Prime[n+k], Prime[n]], bb=Append[bb, k];Goto[ne]];Label[ne], {k, Prime[n]-1}], {n, 100}];bb

%K nonn

%O 1,2

%A _Zak Seidov_, Apr 30 2005

%E Corrected by _Robert Israel_, Oct 27 2017