editing
approved
editing
approved
f[l_List] := Block[{n = Length[l] + 1, k = Mod[Prime[n], n, 1]}, While[MemberQ[l, k], k += n]; Append[l, k]]; Nest[f, {1}, 70] (* _Ray Chandler_, Feb 04 2007 *)
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
If this is a permutation of the positive integers, then A249678 is the inverse permutation. - M. F. Hasler, Nov 03 2014
(PARI) A125718(n, show=0, u=1)={for(n=1, n, p=prime(n)%n; while(bittest(u, p), p+=n); u+=1<<p; show&&print1(p", ")/*a=concat(a, p)*/); p} \\ M. F. Hasler, Nov 03 2014
approved
editing
Leroy Quet , Feb 01 2007
(PARI) {Quet_p3(n)= /* Permutation sequence a'la __Leroy Quet__, , A125718 */local(x=[1], k=0, w=1); for(i=2, n, if((k=prime(i)%i)==0, k=i); while(bittest(w, k-1)>0, k+=i); x=concat(x, k); w+=2^(k-1)); return(x)}
(PARI) {Quet_p3(n)= /* Permutation sequence a'la __Leroy Quet_, _, A125718 */local(x=[1], k=0, w=1); for(i=2, n, if((k=prime(i)%i)==0, k=i); while(bittest(w, k-1)>0, k+=i); x=concat(x, k); w+=2^(k-1)); return(x)}
_Leroy Quet _ Feb 01 2007
(PARI) {Quet_p3(n)= /* Permutation sequence a'la _Leroy Quet, _, A125718 */local(x=[1], k=0, w=1); for(i=2, n, if((k=prime(i)%i)==0, k=i); while(bittest(w, k-1)>0, k+=i); x=concat(x, k); w+=2^(k-1)); return(x)}