login
A257802
Permutation of natural numbers: a(1) = 1, a(lucky(n)) = oddprime(a(n-1)), a(unlucky(n)) = not_an_oddprime(1+a(n)).
4
1, 2, 3, 4, 6, 8, 5, 10, 7, 14, 9, 16, 11, 12, 17, 22, 15, 25, 18, 20, 23, 26, 33, 24, 13, 36, 27, 30, 34, 38, 31, 48, 19, 35, 21, 51, 47, 39, 44, 49, 54, 45, 29, 66, 28, 50, 32, 70, 59, 65, 37, 55, 62, 68, 75, 63, 42, 90, 40, 69, 46, 94, 41, 81, 88, 52, 61, 76, 83, 85, 92, 100, 53, 86, 101, 58, 120, 56, 67, 93, 64
OFFSET
1,2
COMMENTS
Here lucky(n) = n-th lucky number = A000959(n), unlucky(n) = n-th unlucky number = A050505(n), oddprime(n) = n-th odd prime = A065091(n), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).
FORMULA
a(1) = 1; if A145649(n) = 1 [i.e., when n is lucky] then a(n) = A065091(a(A109497(n)-1)), otherwise a(n) = A065090(1+a(n-A109497(n))).
As a composition of other permutations:
a(n) = A257728(A257725(n)).
a(n) = A257729(A257732(n)).
PROG
(Scheme, with memoizing definec-macro)
(definec (A257802 n) (cond ((= 1 n) n) ((= 1 (A145649 n)) (A065091 (A257802 (- (A109497 n) 1)))) (else (A065090 (+ 1 (A257802 (- n (A109497 n))))))))
;; Alternatively, by composing other permutations:
(define (A257802 n) (A257728 (A257725 n)))
CROSSREFS
Inverse: A257801.
Related or similar permutations: A257725, A257728, A257729, A257732.
Sequence in context: A260425 A352064 A277905 * A369271 A225850 A038150
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 09 2015
STATUS
approved