%I #10 Jul 13 2013 12:02:37
%S 1,2,3,5,4,9,8,7,6,13,12,11,10,21,20,19,18,17,16,15,14,29,28,27,26,25,
%T 24,23,22,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,61,60,59,58,
%U 57,56,55,54,53,52,51,50,49,48,47,46,93,92,91,90,89,88,87,86,85,84,83
%N If the numbers a(1)...a(n) contain a hole, then a(n+1) is the largest hole; otherwise a(n+1) = a(n-1) + a(n).
%C A self-inverse permutation of the natural numbers: a(a(n)) = n and a(n) <> n for n > 3. [_Reinhard Zumkeller_, Apr 29 2012]
%H Reinhard Zumkeller, <a href="/A060030/b060030.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 a060030 n = a060030_list !! (n-1)
%o a060030_list = 1 : 2 : f 1 2 [3..] where
%o f u v ws = y : f v y (delete y ws) where
%o y = if null xs then u + v else last xs
%o xs = takeWhile (< v) ws
%o -- _Reinhard Zumkeller_, Apr 29 2012
%Y See A060482 for successive records, A027383 for the final hole-filling values, A016116 for the difference between top and bottom of downward subsequences, A052551 for number of terms in downward subsequences.
%Y Cf. A060000, A000045.
%K easy,nice,nonn
%O 1,2
%A William Nelles (wnelles(AT)flashmail.com), Mar 17 2001
%E Offset corrected by _Reinhard Zumkeller_, Apr 29 2012
|