Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 May 10 2015 11:00:40
%S 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,
%T 27,30,34,38,31,48,19,35,21,51,47,39,44,49,54,45,29,66,28,50,32,70,59,
%U 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
%N Permutation of natural numbers: a(1) = 1, a(lucky(n)) = oddprime(a(n-1)), a(unlucky(n)) = not_an_oddprime(1+a(n)).
%C 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).
%H Antti Karttunen, <a href="/A257802/b257802.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F 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))).
%F As a composition of other permutations:
%F a(n) = A257728(A257725(n)).
%F a(n) = A257729(A257732(n)).
%o (Scheme, with memoizing definec-macro)
%o (definec (A257802 n) (cond ((= 1 n) n) ((= 1 (A145649 n)) (A065091 (A257802 (- (A109497 n) 1)))) (else (A065090 (+ 1 (A257802 (- n (A109497 n))))))))
%o ;; Alternatively, by composing other permutations:
%o (define (A257802 n) (A257728 (A257725 n)))
%Y Inverse: A257801.
%Y Cf. A000959, A050505, A065090, A065091, A109497, A145649.
%Y Related or similar permutations: A257725, A257728, A257729, A257732.
%K nonn
%O 1,2
%A _Antti Karttunen_, May 09 2015