OFFSET
1,1
COMMENTS
Starting at the seed number (14) the sequence continues by dividing, subtracting, adding or multiplying by the step number (2). Division gets precedence over subtraction which gets precedence over addition which gets precedence over multiplication. The new number must be a positive integer and not previously listed. The sequence terminates if this is impossible.
Less chaotic sequences are obtained if division is not included (see for example A254868).
These sequences were first explored by Brian Kehrig, a 15-year-old student at Renert School, Calgary, Canada.
They are exceptionally good sequences to introduce to the elementary school math classroom.
Like many Recamán sequences, this is worth listening to.
EXAMPLE
a(1) = 14. a(2) = 14/2 = 7. a(3) = 7-2 = 5. a(4) = 5-2 = 3. a(5) = 3-2 = 1. a(6) = 1*2 = 2. a(7) = 2+2 = 4. a(8) = 4+2 = 6.
MATHEMATICA
f[lst_List] := Block[{k = lst[[-1]]}, If[ Mod[k, 2] == 0 && !MemberQ[lst, k/2], k /= 2, If[k > 2 && !MemberQ[lst, k - 2], k -= 2, If[ !MemberQ[lst, k + 2], k += 2, k *= 2]]]; Append[lst, k]]; lst = {14}; Nest[f, lst, 70] (* Robert G. Wilson v, Feb 20 2015 *)
CROSSREFS
KEYWORD
AUTHOR
Gordon Hamilton, Feb 09 2015
STATUS
approved