login
Smallest k such that k(p-1)-1 is positive and divisible by p where p = n-th prime.
5

%I #21 Oct 30 2015 20:33:20

%S 3,2,4,6,10,12,16,18,22,28,30,36,40,42,46,52,58,60,66,70,72,78,82,88,

%T 96,100,102,106,108,112,126,130,136,138,148,150,156,162,166,172,178,

%U 180,190,192,196,198,210,222,226,228,232,238,240,250,256,262,268,270

%N Smallest k such that k(p-1)-1 is positive and divisible by p where p = n-th prime.

%C Also smallest positive k such that the k-th triangular number is divisible by the n-th prime. - _Reinhard Zumkeller_, Apr 19 2002

%H T. D. Noe, <a href="/A039915/b039915.txt">Table of n, a(n) for n=1..1000</a>

%F a(n) = p+(-1)^p. - _Juri-Stepan Gerasimov_, May 26 2009

%e a(1)=3 because 3(2-1)-1=2 is divisible by 2.

%t kp[n_]:=Module[{p=Prime[n],k=1},While[!Divisible[(k(k+1))/2,p],k++];k]; Array[kp,60] (* _Harvey P. Dale_, Jun 12 2012 *)

%t a[n_] := Prime[n]-1; a[1]=3; Table[a[n], {n, 1, 58}] (* _Jean-François Alcover_, Dec 26 2012, after _Juri-Stepan Gerasimov_ *)

%Y Cf. A000217, A039678.

%Y Essentially the same as A006093.

%K nonn

%O 1,1

%A _Felice Russo_

%E Edited and extended by _Ray Chandler_, Jun 06 2008