login
A120332
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).
0
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, 29, 15, 27, 84, 32, 31, 18, 57, 20, 55, 41, 69, 22, 63, 37, 96, 47, 65, 77, 75, 43, 26, 53, 81, 76, 80, 49, 87, 36, 72, 34, 93, 61, 140, 59, 96, 40, 67, 44, 156, 64, 95, 38, 168, 73
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
Sequence in context: A054080 A356067 A164379 * A302698 A205401 A366264
KEYWORD
nonn
AUTHOR
Leroy Quet, Jun 22 2006
EXTENSIONS
More terms from Max Alekseyev, Mar 26 2007
STATUS
approved