The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 3
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, 24, 23, 22, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
A self-inverse permutation of the natural numbers: a(a(n)) = n and a(n) <> n for n > 3. [Reinhard Zumkeller, Apr 29 2012]
LINKS
MATHEMATICA
a[1] = 1; a[2] = 2;
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]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Apr 23 2024 *)
PROG
(Haskell)
import Data.List (delete)
a060030 n = a060030_list !! (n-1)
a060030_list = 1 : 2 : f 1 2 [3..] where
f u v ws = y : f v y (delete y ws) where
y = if null xs then u + v else last xs
xs = takeWhile (< v) ws
-- Reinhard Zumkeller, Apr 29 2012
CROSSREFS
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.
Sequence in context: A330615 A302850 A338253 * A081025 A329811 A245607
KEYWORD
easy,nice,nonn
AUTHOR
William Nelles (wnelles(AT)flashmail.com), Mar 17 2001
EXTENSIONS
Offset corrected by Reinhard Zumkeller, Apr 29 2012
Name made more explicit by Jean-François Alcover, Apr 23 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 13 13:31 EDT 2024. Contains 372519 sequences. (Running on oeis4.)