login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A096016
A modified Fibonacci sequence controlled by a toggle switch. The toggle switch (initial state of 2) flips between 2 and 3 after each reduction.
0
0, 1, 1, 2, 3, 5, 4, 3, 7, 5, 4, 9, 13, 11, 8, 19, 27, 23, 50, 73, 41, 57, 98, 155, 253, 136, 389, 525, 457, 982, 1439, 807, 1123, 1930, 3053, 1661, 2357, 4018, 2125, 6143, 4134, 10277, 14411, 24688, 13033, 37721, 25377, 63098, 88475, 151573, 80016, 231589
OFFSET
0,4
COMMENTS
Initial state: a(1)=0, a(2)=1, j=2; thereafter a(n) = a(n-1) + a(n-2) and if a(n)>2, j=2 and a(n) == 0 (mod 2) then a(n) = a(n)/j and j=3; if a(n)>3, j=3 and a(n) == 0 (mod 3) then a(n) = a(n)/j and j=2.
EXAMPLE
a(0) = 0 by definition and the initial state of the toggle switch is 2;
a(1) = 1 by definition;
a(2) = 0+1 = 1;
a(3) = 1+1 = 2;
a(4) = 1+2 = 3;
a(5) = 2+3 = 5;
a(6) = 3+5 => 8 => 4 since 8 > 2, therefore 8/2 = 4 and toggle the switch from 2 to 3;
a(7) = 5+4 => 9 => 3 since 9 is > 3, therefore 9/3 = 3 and toggle the switch from 3 back to 2;
a(8) = 4+3 = 7;
a(9) = 3+7 => 10 => 5 since 10 is > 2, therefore 10/2 = 5 and toggle the switch to 3;
a(10) = 7+5 => 12 => 4 since 12 is > 3, therefore 12/3 = 4 and toggle the switch to 2;
a(11) = 5+4 = 9, cannot reduce by the toggle switch because 9/2 is not an integer;
a(12) = 4+9 = 13;
a(13) = 9+13 => 22 => 11 and toggle the switch to 3;
a(14) = 13+11 => 24 => 8 and set the toggle switch to 2;
a(15) = 11+8 = 19, etc.
MATHEMATICA
a[0] = 0; a[1] = 1; ts = 0; a[n_] := a[n] = Block[{b = a[n - 1] + a[n - 2]}, If[ IntegerQ[ b / (ts + 2)] && b > 3, b = b/(ts + 2); ts = Mod[ts + 1, 2]]; b]; Table[ a[n], {n, 0, 52}] (* Robert G. Wilson v, Jul 21 2004 *)
CROSSREFS
Sequence in context: A330806 A058981 A117339 * A123274 A214674 A185332
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jul 20 2004
EXTENSIONS
Edited by Robert G. Wilson v, Jul 21 2004
STATUS
approved