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!)
A079053 Recamán Fibonacci variation: a(1)=1; a(2)=2; for n > 2, a(n) = a(n-1)+a(n-2)-F(n) if that number is positive and not already in the sequence, otherwise a(n) = a(n-1)+a(n-2)+F(n) where F(n) denotes the n-th Fibonacci number. 8

%I #30 Feb 21 2024 10:53:34

%S 1,2,5,4,14,10,11,42,19,6,114,264,145,32,787,1806,996,218,5395,12378,

%T 6827,1494,36978,84840,46793,10240,253451,581502,320724,70186,1737179,

%U 3985674,2198275,481062,11906802,27318216,15067201,3297248,81610435

%N Recamán Fibonacci variation: a(1)=1; a(2)=2; for n > 2, a(n) = a(n-1)+a(n-2)-F(n) if that number is positive and not already in the sequence, otherwise a(n) = a(n-1)+a(n-2)+F(n) where F(n) denotes the n-th Fibonacci number.

%C Starting with other initial values a(1)=x a(2)=y gives the same kind of recurrence relations.

%H Reinhard Zumkeller, <a href="/A079053/b079053.txt">Table of n, a(n) for n = 1..1000</a>

%F For n>2, if n==0 or 2 (mod 4) a(n)=2*a(n-1)-a(n-2)-a(n-4); if n==1 or 3 (mod 4) a(n)=a(n-2)+2*a(n-3)+a(n-4) lim n ->infinity a(4n)/a(4n-1)=2.29433696806047607330083539....; lim n ->infinity a(4n-1)/a(4n-2)=24.7510757456062014116731647..; lim n ->infinity a(4n-2)/a(4n-3)=0.218836132868832627648170038...; lim n ->infinity a(4n-3)/a(4n-4)=0.551544105222898180785441647...

%F Empirical g.f.: x*(26*x^10+68*x^8+6*x^7-4*x^6+16*x^5-12*x^4-5*x^2-x-1) / ((x^2+x-1)*(x^4+3*x^2+1)). - _Colin Barker_, Jun 26 2013

%e a(10)=6 because a(9)+a(8)-F(10)=19+42-55=6 and 6 is not already in the sequence. a(11)=42 because a(10)+a(9)-F(11)=6+19-89 < 0 then a(11)=6+19+89=114.

%t a[1] = 1; a[2] = 2; a[n_] := a[n] = (an = a[n-1] + a[n-2] - Fibonacci[n]; If[an > 0 && ! MemberQ[Array[a, n-1], an], an, a[n-1] + a[n-2] + Fibonacci[n]]); Table[a[n], {n, 1, 39}] (* _Jean-François Alcover_, Jun 18 2012 *)

%o (PARI) m=200; a=vector(m); a[1]=1; a[2]=2; for(n=3, m, a[n]=if(n<0, 0, if(abs(sign(a[n-1]+a[n-2]-fibonacci(n))-1)+setsearch(Set(vector(n-1, i, a[i])), a[n-1]+a[n-2]-fibonacci(n)), a[n-1]+a[n-2]+fibonacci(n), a[n-1]+a[n-2]-fibonacci(n)))); a - corrected by _Colin Barker_, Jun 26 2013

%o (Haskell)

%o import Data.Set (Set, fromList, notMember, insert)

%o a079053 n = a079053_list !! (n-1)

%o a079053_list = 1 : 2 : r (fromList [1,2]) 1 1 1 2 where

%o r :: Set Integer -> Integer -> Integer -> Integer -> Integer -> [Integer]

%o r s i j x y = if v > 0 && v `notMember` s

%o then v : r (insert v s) j fib y v

%o else w : r (insert w s) j fib y w where

%o fib = i + j

%o v = x + y - fib

%o w = x + y + fib

%o for_bFile = take 1000 a079053_list -- _Reinhard Zumkeller_, Mar 14 2011

%Y Cf. A005132.

%K nice,nonn

%O 1,2

%A _Benoit Cloitre_, Feb 02 2003

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 March 29 09:59 EDT 2024. Contains 371268 sequences. (Running on oeis4.)