OFFSET

1,2

COMMENTS

Sequence is a permutation of the positive integers and is its own inverse permutation.

EXAMPLE

6 (= 2*3) is not among the first 5 terms of the sequence. So for a(6) we want the prime powers closest to and larger than 2 and 3, which are 3 and 4. So a(6) = 3*4 = 12. Therefore 12 (=2^2 *3) does occur among the first 11 terms of the sequence. So for a(12) we want the product of the prime powers closest to and less than 2^2 and 3, which are 3 and 2. So a(12) = 3*2 = 6.

PROG

(PARI) { a(n) = local(f, r, k, d, j); f=factorint(n); r=1; if(setsearch(S, n), j=-1, j=1); for(i=1, matsize(f)[1], k=f[i, 1]^f[i, 2]+j; while(k>1 && !isprime(k) && (!ispower(k, X=X, &d)||!isprime(d)), k+=j); r*=k); S=setunion(S, [r]); r } S=Set(); vector(100, n, a(n)) - Max Alekseyev, Mar 26 2007

CROSSREFS

KEYWORD

nonn

AUTHOR

Leroy Quet, Jun 22 2006

EXTENSIONS

More terms from Max Alekseyev, Mar 26 2007

STATUS

approved