login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A066949 Take the sum of the previous two terms, subtract n if this sum is greater than n. 1
0, 1, 1, 2, 3, 5, 2, 7, 1, 8, 9, 6, 3, 9, 12, 6, 2, 8, 10, 18, 8, 5, 13, 18, 7, 25, 6, 4, 10, 14, 24, 7, 31, 5, 2, 7, 9, 16, 25, 2, 27, 29, 14, 43, 13, 11, 24, 35, 11, 46, 7, 2, 9, 11, 20, 31, 51, 25, 18, 43, 1, 44, 45, 26, 7, 33, 40, 6, 46, 52, 28, 9, 37, 46, 9, 55, 64, 42, 28, 70, 18 (list; graph; refs; listen; history; internal format)
OFFSET

0,4

LINKS

T. D. Noe, Table of n, a(n) for n=0..10000

FORMULA

a(n) = a(n-1)+a(n-2)-n if a(n-1)+a(n-2)>n, a(n) = a(n-1)+a(n-2) otherwise; a(0) = 0, a(1) = 1.

MATHEMATICA

a[0] = 0; a[1] = 1; a[n_] := a[n] = Block[ {b = a[n - 1] + a[n - 2]}, If[b > n, Return[b - n], Return[b]]]; Table[a[n], {n, 0, 80} ]

PROG

(Haskell)

a066949 n = a066949_list !! n

a066949_list = 0 : 1 : f 2 1 0 where

   f k x x' | z > k     = (z - k) : f (k+1) (z - k) x

            | otherwise = z : f (k+1) z x where z = x + x'

-- Reinhard Zumkeller, Oct 17 2011

CROSSREFS

Cf. A000045.

Sequence in context: A053723 A138512 A201652 * A073481 A178094 A122556

Adjacent sequences:  A066946 A066947 A066948 * A066950 A066951 A066952

KEYWORD

easy,nonn,nice

AUTHOR

Floor van Lamoen (fvlamoen(AT)hotmail.com), Jan 25 2002

EXTENSIONS

Edited by Robert G. Wilson v (rgwv(AT)rgwv.com), Jan 31 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 17 21:13 EST 2012. Contains 206085 sequences.