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”).

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

%I #12 Dec 06 2015 23:22:02

%S 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,

%T 389,525,457,982,1439,807,1123,1930,3053,1661,2357,4018,2125,6143,

%U 4134,10277,14411,24688,13033,37721,25377,63098,88475,151573,80016,231589

%N A modified Fibonacci sequence controlled by a toggle switch. The toggle switch (initial state of 2) flips between 2 and 3 after each reduction.

%C 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.

%e a(0) = 0 by definition and the initial state of the toggle switch is 2;

%e a(1) = 1 by definition;

%e a(2) = 0+1 = 1;

%e a(3) = 1+1 = 2;

%e a(4) = 1+2 = 3;

%e a(5) = 2+3 = 5;

%e a(6) = 3+5 => 8 => 4 since 8 > 2, therefore 8/2 = 4 and toggle the switch from 2 to 3;

%e a(7) = 5+4 => 9 => 3 since 9 is > 3, therefore 9/3 = 3 and toggle the switch from 3 back to 2;

%e a(8) = 4+3 = 7;

%e a(9) = 3+7 => 10 => 5 since 10 is > 2, therefore 10/2 = 5 and toggle the switch to 3;

%e a(10) = 7+5 => 12 => 4 since 12 is > 3, therefore 12/3 = 4 and toggle the switch to 2;

%e a(11) = 5+4 = 9, cannot reduce by the toggle switch because 9/2 is not an integer;

%e a(12) = 4+9 = 13;

%e a(13) = 9+13 => 22 => 11 and toggle the switch to 3;

%e a(14) = 13+11 => 24 => 8 and set the toggle switch to 2;

%e a(15) = 11+8 = 19, etc.

%t 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 *)

%K nonn

%O 0,4

%A _Pierre CAMI_, Jul 20 2004

%E Edited by _Robert G. Wilson v_, Jul 21 2004