%I #8 Apr 09 2014 10:15:02
%S 1,3,2,5,4,12,8,7,11,21,9,6,16,24,28,13,19,33,17,35,10,39,25,14,23,48,
%T 29,15,27,84,32,31,18,57,20,55,41,69,22,63,37,96,47,65,77,75,43,26,53,
%U 81,76,80,49,87,36,72,34,93,61,140,59,96,40,67,44,156,64,95,38,168,73
%N If n is among earlier terms of sequence, then replace each prime power in the prime-factorization of n with the next lower prime-power to get a(n). If n is not among earlier terms of sequence, then replace each prime power in the prime-factorization of n with the next higher prime-power to get a(n).
%C Sequence is a permutation of the positive integers and is its own inverse permutation.
%e 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.
%o (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
%Y Cf. A120635, A120636.
%K nonn
%O 1,2
%A _Leroy Quet_, Jun 22 2006
%E More terms from _Max Alekseyev_, Mar 26 2007