Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #30 Aug 04 2015 20:44:46
%S 3,4,1,2,7,8,5,6,11,12,9,10,14,13,17,18,15,16,20,19,23,24,21,22,26,25,
%T 28,27,31,32,29,30,35,36,33,34,38,37,41,42,39,40,44,43,46,45,48,47,50,
%U 49,53,54,51,52,56,55,58,57,60,59,62,61,65,66,63,64,68
%N Lexicographically smallest permutation of the natural numbers, such that a(n)+n is a composite number and a(n) != n.
%C The permutation is self-inverse: a(a(n)) = n;
%C by definition there are no fixed points.
%H Reinhard Zumkeller, <a href="/A260822/b260822.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>
%o (Haskell)
%o import Data.List (delete)
%o a260822 n = a260822_list !! (n-1)
%o a260822_list = f 1 [1..] where
%o f x zs = g zs where
%o g (y:ys) = if y /= x && a010051' (x + y) == 0
%o then y : f (x + 1) (delete y zs) else g ys
%Y Cf. A010051, A002808, A260933.
%K nonn
%O 1,1
%A _Reinhard Zumkeller_, Aug 04 2015