login
A257732
Permutation of natural numbers: a(1) = 1, a(lucky(n)) = prime(a(n-1)), a(unlucky(n)) = composite(a(n)), where lucky(n) = n-th lucky number A000959, unlucky(n) = n-th unlucky number A050505, and prime = A000040, composite = A002808.
6
1, 4, 2, 9, 6, 16, 7, 12, 3, 26, 14, 21, 23, 8, 13, 39, 24, 33, 35, 15, 53, 22, 56, 36, 17, 49, 51, 25, 75, 34, 37, 78, 5, 52, 27, 69, 101, 72, 38, 102, 50, 54, 43, 106, 10, 74, 40, 94, 73, 134, 83, 98, 55, 135, 70, 76, 62, 141, 18, 100, 57, 125, 19, 99, 175, 114, 41, 130, 167, 77, 176, 95, 89, 104, 137, 86, 184, 28, 149, 133, 80, 164, 30
OFFSET
1,2
COMMENTS
In other words, a(1) = 1 and for n > 1, if n is the k-th lucky number larger than 1 [i.e., n = A000959(k+1)] then a(n) = nthprime(a(k)), otherwise, when n is the k-th unlucky number [i.e., n = A050505(k)], then a(n) = nthcomposite(a(k)).
FORMULA
a(1) = 1; for n > 1: if A145649(n) = 1 [i.e., if n is lucky], then a(n) = A000040(a(A109497(n)-1)), otherwise a(n) = A002808(a(n-A109497(n))).
As a composition of other permutations:
a(n) = A246378(A257725(n)).
a(n) = A255422(A257734(n)).
PROG
(Scheme) ;; With memoization-macro definec.
(definec (A257732 n) (cond ((= 1 n) n) ((= 1 (A145649 n)) (A000040 (A257732 (- (A109497 n) 1)))) (else (A002808 (A257732 (- n (A109497 n)))))))
;; Alternatively, by composing other permutations:
(define (A257732 n) (A246378 (A257725 n)))
(define (A257732 n) (A255422 (A257734 n)))
CROSSREFS
Inverse: A257731.
Related or similar permutations: A246378, A255422, A257725, A257734.
Cf. also A032600, A255553, A255554.
Sequence in context: A282600 A326845 A257734 * A351164 A101690 A213781
KEYWORD
nonn,look
AUTHOR
Antti Karttunen, May 06 2015
STATUS
approved