This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A257731 #12 May 07 2015 11:00:54 %S A257731 1,3,9,2,33,5,7,14,4,45,163,8,15,11,20,6,25,59,63,203,12,22,13,17,28, %T A257731 10,35,78,235,83,1093,251,18,30,19,24,31,39,16,47,67,101,43,290,107, %U A257731 1283,87,309,26,41,27,34,21,42,53,23,61,88,115,128,321,57,354,137,1499,112,349,376,36,55,1401,38,49,46,29,56,70,32,99,81 %N A257731 Permutation of natural numbers: a(1) = 1, a(prime(n)) = lucky(1+a(n)), a(composite(n)) = unlucky(a(n)), where prime(n) = n-th prime number A000040, composite(n) = n-th composite number A002808 and lucky = A000959, unlucky = A050505. %H A257731 Antti Karttunen, <a href="/A257731/b257731.txt">Table of n, a(n) for n = 1..6185</a> %H A257731 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A257731 a(1) = 1; for n > 1: if A010051(n) = 1 [i.e., if n is a prime], then a(n) = A000959(1+a(A000720(n))), otherwise a(n) = A050505(a(A065855(n))). %F A257731 As a composition of other permutations: %F A257731 a(n) = A257726(A246377(n)). %F A257731 a(n) = A257733(A255421(n)). %o A257731 (Scheme, with memoization-macro definec) %o A257731 (definec (A257731 n) (cond ((= 1 n) n) ((= 1 (A010051 n)) (A000959 (+ 1 (A257731 (A000720 n))))) (else (A050505 (A257731 (A065855 n)))))) %o A257731 ;; Alternatively, by composing other permutations: %o A257731 (define (A257731 n) (A257726 (A246377 n))) %o A257731 (define (A257731 n) (A257733 (A255421 n))) %Y A257731 Inverse: A257732. %Y A257731 Cf. A000040, A000720, A000959, A002808, A010051, A050505, A065855. %Y A257731 Related or similar permutations: A246377, A255421, A257726, A257733. %Y A257731 Cf. also A032600, A255553, A255554. %Y A257731 Differs from A257733 for the first time at n=19, where a(19) = 63, while A257733(19) = 203. %K A257731 nonn %O A257731 1,2 %A A257731 _Antti Karttunen_, May 06 2015