This site is supported by donations to The OEIS Foundation.

 Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing. Other ways to donate

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A236768 A recurrence relation conditioned on the primality of the preceding terms. 1
 1, 2, 3, 5, 8, 13, 21, 34, 13, 47, 60, 107, 167, 274, 441, 167, 608, 775, 167, 942, 1109, 2051, 3160, 1109, 4269, 5378, 1109, 6487, 7596, 1109, 8705, 9814, 1109, 10923, 12032, 1109, 13141, 14250, 1109, 15359, 16468, 31827, 15359, 47186, 62545, 15359, 77904, 93263, 171167, 264430 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,2 COMMENTS This is like the Fibonacci sequence but subtraction replaces addition when neither of the preceding two terms are prime numbers. LINKS Paul Tek, Table of n, a(n) for n = 0..1000 FORMULA a(0) = 1, a(1) = 2, a(n) = a(n-1) + a(n-2) unless both a(n-1) and a(n-2) are composite, then a(n) = a(n-1) - a(n-2). EXAMPLE a(6) = 21 because a(5)=13 is prime and 13 + 8 = 21. a(7) = 34 because a(5) is prime and 21 + 13 = 34. a(8) = 13 because neither a(6) nor a(7) is prime and 34 - 21 = 13. MATHEMATICA modFibo[0] := 1; modFibo[1] := 2; modFibo[n_] := modFibo[n] = modFibo[n - 1] + (-1)^(Boole[Not[PrimeQ[modFibo[n - 1]] || PrimeQ[modFibo[n - 2]]]])modFibo[n - 2]; Table[modFibo[n], {n, 0, 49}] (* Alonso del Arte, Jan 31 2014 *) CROSSREFS Sequence in context: A013986 A121343 A321021 * A023439 A147660 A013987 Adjacent sequences:  A236765 A236766 A236767 * A236769 A236770 A236771 KEYWORD nonn,easy AUTHOR Stephen McDonald, Jan 30 2014 STATUS approved

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

Last modified December 13 12:45 EST 2019. Contains 329968 sequences. (Running on oeis4.)