login
Rearrangement of natural numbers such that n*a(n) + 1 is a prime.
3

%I #16 Sep 24 2018 16:53:14

%S 1,2,4,3,6,5,10,9,8,7,18,13,12,14,16,15,24,11,22,20,26,19,30,17,28,21,

%T 34,25,32,23,36,29,40,27,42,31,48,39,38,33,56,35,46,47,50,43,44,37,52,

%U 45,60,49,66,54,58,41,68,55,62,51,70,59,74,67,86,53,64,57,72,61,98,69

%N Rearrangement of natural numbers such that n*a(n) + 1 is a prime.

%C k pertaining to A111296. {A111296(n)-1}/n.

%C If a(n) = m then a(m) = n.

%C a(a(n)) = n; a(A131221(n)) = A131221(n). - _Reinhard Zumkeller_, Jun 18 2007

%H R. Zumkeller, <a href="/A087559/b087559.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%p s := {seq(i,i=2..2000)}:a[1] := 1:for n from 2 to 120 do l := sort(convert(s,list)): k := 1: while(not isprime(n*l[k]+1)) do k := k+1: if(k>nops(l)) then print("Overflow"):fi:od: a[n] := l[k]:s := s minus {a[n]}:od:seq(a[l],l=1..120); # _Sascha Kurz_

%t l = {}; Do[k = 1; While[MemberQ[l, k] || !PrimeQ[n*k + 1], k++ ]; AppendTo[l, k], {n, 100}]; l (* _Ryan Propper_, Jun 15 2006 *)

%Y Cf. A111296.

%K nonn

%O 1,2

%A _Amarnath Murthy_, Sep 13 2003

%E More terms from _Sascha Kurz_, Sep 22 2003

%E Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, Jun 09 2007