

A083569


Smallest m not occurring earlier such that m+n is prime.


4



1, 3, 2, 7, 6, 5, 4, 9, 8, 13, 12, 11, 10, 15, 14, 21, 20, 19, 18, 17, 16, 25, 24, 23, 22, 27, 26, 31, 30, 29, 28, 35, 34, 33, 32, 37, 36, 41, 40, 39, 38, 47, 46, 45, 44, 43, 42, 49, 48, 51, 50, 55, 54, 53, 52, 57, 56, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 79, 78, 77
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

a(a(n))=n: a selfinverse permutation with A010051(a(n)+n)=1.  Reinhard Zumkeller, Nov 25 2004


LINKS

Paul Tek, Table of n, a(n) for n = 1..1000
Index entries for sequences that are permutations of the natural numbers


PROG

(PARI) A083569(n)={global(a083569); type(a083569)=="t_VEC"a083569=vector(n); #a083569<n&&a083569=concat(a083569, vector(n#a083569)); my(u=[0]); a083569[n]for(i=1, n, a083569[i]for(k=u[1]+1, 9e9, !setsearch(u, k)&&isprime(i+k)&&(a083569[i]=k)&&break); u=setunion(u, [a083569[i]]); while(#u>1&&u[2]==u[1]+1, u=u[2..1])); a083569[n]} \\ Returns the nth term and defines the global array a083569 up to that value at least. For efficiency it is better to (pre)compute a large number of terms at once (via A083569(N_max)) rather than one after the other.  M. F. Hasler, Apr 11 2015


CROSSREFS

Cf. A084721.
Cf. A071065.
Sequence in context: A072764 A130328 A228993 * A071574 A276344 A334727
Adjacent sequences: A083566 A083567 A083568 * A083570 A083571 A083572


KEYWORD

nonn


AUTHOR

Amarnath Murthy, Jun 12 2003


EXTENSIONS

More terms from David Wasserman, Nov 19 2004


STATUS

approved



