login
Numbers n such that n == prime(m) (mod prime(m+1)) for any m.
1

%I #9 Mar 31 2018 00:26:17

%S 2,3,5,7,8,11,12,13,14,17,18,19,20,23,24,26,28,29,30,31,32,33,35,36,

%T 37,38,40,41,42,43,44,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,64,

%U 65,67,68,71,73,74,75,76,77,78,79,80,81,82,83,84,86,88,89,90,91,92,93,95

%N Numbers n such that n == prime(m) (mod prime(m+1)) for any m.

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

%e 24 because 24 mod 13 = 11. 40 because 40 mod 7 = 5. 51 because 51 mod 11 = 7.

%p N:= 500: # for all terms <= N

%p p:= 2:

%p S:= {}:

%p while p <= N do

%p q:= nextprime(p);

%p S:= S union {seq(i,i=p..N,q)};

%p p:= q;

%p od:

%p sort(convert(S,list)); # _Robert Israel_, Mar 30 2018

%t nn=150; u={}; Do[lst=Prime[i]+Range[0, Ceiling[nn/Prime[i+1]]]Prime[i+1]; u=Union[u, lst], {i, PrimePi[nn]}]; Intersection[u, Range[nn]] (Noe)

%K nonn

%O 1,1

%A Christopher M. Tomaszewski (cmt1288(AT)comcast.net), May 14 2005

%E Corrected and extended by _T. D. Noe_, Oct 25 2005