cp's OEIS Frontend

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.

A060030 a(1) = 1, a(2) = 2; thereafter a "hole" is defined to be any positive number not in the sequence a(1)..a(n-1) and less than the largest term; if there exists at least one hole, then a(n) is the largest hole, otherwise a(n) = a(n-2) + a(n-1).

This page as a plain text file.
%I A060030 #21 Apr 24 2024 12:56:35
%S A060030 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 A060030 24,23,22,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,61,60,59,58,
%U A060030 57,56,55,54,53,52,51,50,49,48,47,46,93,92,91,90,89,88,87,86,85,84,83
%N A060030 a(1) = 1, a(2) = 2; thereafter a "hole" is defined to be any positive number not in the sequence a(1)..a(n-1) and less than the largest term; if there exists at least one hole, then a(n) is the largest hole, otherwise a(n) = a(n-2) + a(n-1).
%C A060030 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 A060030 Reinhard Zumkeller, <a href="/A060030/b060030.txt">Table of n, a(n) for n = 1..10000</a>
%H A060030 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A060030 a[1] = 1; a[2] = 2;
%t A060030 a[n_] := a[n] = Module[{A, H}, A = Array[a, n-1]; H = Complement[ Range[a[n-1]], A]; If[H != {}, H[[-1]], a[n-2] + a[n-1]]];
%t A060030 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Apr 23 2024 *)
%o A060030 (Haskell)
%o A060030 import Data.List (delete)
%o A060030 a060030 n = a060030_list !! (n-1)
%o A060030 a060030_list = 1 : 2 : f 1 2 [3..] where
%o A060030    f u v ws = y : f v y (delete y ws) where
%o A060030      y = if null xs then u + v else last xs
%o A060030      xs = takeWhile (< v) ws
%o A060030 -- _Reinhard Zumkeller_, Apr 29 2012
%Y A060030 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 A060030 Cf. A060000, A000045.
%K A060030 easy,nice,nonn
%O A060030 1,2
%A A060030 William Nelles (wnelles(AT)flashmail.com), Mar 17 2001
%E A060030 Offset corrected by _Reinhard Zumkeller_, Apr 29 2012
%E A060030 Name made more explicit by _Jean-François Alcover_, Apr 23 2024