|
|
A083569
|
|
Smallest m not occurring earlier such that m+n is prime.
|
|
5
|
|
|
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
|
|
|
LINKS
|
|
|
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 n-th 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
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|