|
| |
|
|
A060000
|
|
If the numbers a(1)...a(n) contain a hole, then a(n+1) is the smallest hole; otherwise a(n+1) = a(n-1) + a(n).
|
|
5
|
|
|
|
1, 2, 3, 5, 4, 9, 6, 7, 8, 15, 10, 11, 12, 13, 14, 27, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 99, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
|
OFFSET
|
1,2
|
|
|
COMMENTS
|
Let H be the set of positive numbers less than a(n) which are not equal to some a(i), i < n. This H is the 'set of holes so far'. If H is nonempty, then define a(n+1) = minimum(H). Otherwise define a(n+1) = a(n-1) + a(n).
Permutation of the natural numbers with inverse A099424.
A060013(n+1) = a(A060013(n)+1). - Reinhard Zumkeller, Mar 04 2008
|
|
|
LINKS
|
_Reinhard Zumkeller_, Table of n, a(n) for n = 1..10000
Index entries for sequences that are permutations of the natural numbers
|
|
|
FORMULA
|
a(k)=k-1 if k>=7 and k <> 2^m * 3 + 4; a(k)=(k-1)*2-3 if k>=7 and k == 2^m * 3 + 4; - Alfred Heiligenbrunner (alfred.heiligenbrunner(AT)gmx.at), Jun 08 2004
|
|
|
EXAMPLE
|
a(6)=9 because the sequence a(1)..a(5) contains no holes. a(7)=6 because 6 is the first hole in a(1)..a(6).
|
|
|
MATHEMATICA
|
h = {1, 2}; a = 1; b = 2; Do[ g = Sort[ h ]; If[ g[ [ -1 ] ] + 1 == n, c = a + b, k = 1; While[ g[ [ k ] ] == k, k++ ]; c = k ]; a = b; b = c; h = Append[ h, c ], { n, 3, 100} ]; h
(* faster program *) h = {1, 2, 3, 5, 4, 9}; lastSum = 9; Do[AppendTo[h, If[ ++akt < lastSum, akt, ++akt; lastSum = 2*lastSum - 3]], {akt, 5, 100}]; h (from Alfred Heiligenbrunner (alfred.heiligenbrunner(AT)gmx.at), Jun 05 2004)
|
|
|
PROG
|
(Haskell)
a060000 n = a060000_list !! (n-1)
a060000_list = 1 : 2 : f 1 2 2 [] where
f x y m [] = z : f y z z [m+1..z-1] where z = x + y
f x y m (h:hs) = h : f y h m hs
-- Reinhard Zumkeller, Sep 22 2011
|
|
|
CROSSREFS
|
Cf. A060013, A060030, A000045.
Sequence in context: A120255 A182395 A059450 * A074050 A075301 A156031
Adjacent sequences: A059997 A059998 A059999 * A060001 A060002 A060003
|
|
|
KEYWORD
|
easy,nonn,nice
|
|
|
AUTHOR
|
Rainer Rosenthal, Mar 09 2001
|
|
|
EXTENSIONS
|
More terms from Robert G. Wilson v and Larry Reeves (larryr(AT)acm.org), Mar 15 2001
Subscripts corrected in the example - Paolo P. Lava, Jun 13 2012
|
|
|
STATUS
|
approved
|
| |
|
|