

A254868


Recamán [, +, *]sequence with seed 6 and step 4.


2



6, 2, 8, 4, 16, 12, 48, 44, 40, 36, 32, 28, 24, 20, 80, 76, 72, 68, 64, 60, 56, 52, 208, 204, 200, 196, 192, 188, 184, 180, 176, 172, 168, 164, 160, 156, 152, 148, 144, 140, 136, 132, 128, 124, 120, 116, 112, 108, 104, 100, 96, 92, 88, 84, 336, 332, 328, 324
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Starting at the seed number (6) the sequence continues by subtracting, adding or multiplying by the step number (4). Subtracting 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, but for this seed (6) and step (4) the sequence is infinite.
More chaotic sequences are obtained if division is included: cf. A254873.
These sequences were first explored by Brian Kehrig, a 15yearold student at Renert School, Calgary, Canada.
They are exceptionally nice sequences to introduce to the elementary school math classroom.
Like many Recamán sequences, this is worth listening to.


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..100000


EXAMPLE

a(1) = 6. a(2) = 64 = 2. a(3) = 2*4 = 8. a(4) = 84 = 4. a(5) = 4*4 = 16. a(6) = 164 = 12. a(7) = 12*4 = 48 ...


PROG

(Sage)
A=[6]
step=4
for i in [1..100]:
if A[i1]step>0 and (A[i1]step) not in A:
A.append(A[i1]step)
else:
if not((A[i1]+step) in A):
A.append(A[i1]+step)
else:
A.append(step*A[i1])
A #  Tom Edgar, Feb 16 2015
(Haskell)
import Data.Set (Set, singleton, notMember, insert)
a254868 n = a254868_list !! (n1)
a254868_list = 6 : kehrig (singleton 6) 6 where
kehrig s x  x > 4 && (x  4) `notMember` s =
(x  4) : kehrig (insert (x  4) s) (x  4)
 (x + 4) `notMember` s =
(x + 4) : kehrig (insert (x + 4) s) (x + 4)
 otherwise =
(x * 4) : kehrig (insert (x * 4) s) (x * 4)
 Reinhard Zumkeller, Feb 25 2015


CROSSREFS

Cf. A005132 (original Recamán sequence).
Cf. A254873 (an example with division at the top in the hierarchy of operations).
Sequence in context: A079718 A062771 A249919 * A071874 A011331 A155687
Adjacent sequences: A254865 A254866 A254867 * A254869 A254870 A254871


KEYWORD

easy,hear,nonn


AUTHOR

Gordon Hamilton, Feb 09 2015


STATUS

approved



