Recaman's sequence: Difference between revisions

Content added Content deleted
Line 1,143: Line 1,143:


{{FormulaeEntry|page=https://formulae.org/?script=examples/Recam%C3%A1n%27s_sequence}}
{{FormulaeEntry|page=https://formulae.org/?script=examples/Recam%C3%A1n%27s_sequence}}

'''Solution'''

The following snippet generates the Recaman's sequence of a given number of terms:

[[File:Fōrmulæ - Recamán's sequence 01.png]]

'''Case 1'''

* Generate and show here the first 15 members of the sequence.
* Find and show here, the first duplicated number in the sequence.
* Optionally. Find and show here, How many terms of the sequence are needed until all the integers 0..1000, inclusive, are generated.

[[File:Fōrmulæ - Recamán's sequence 02.png]]

[[File:Fōrmulæ - Recamán's sequence 03.png]]

[[File:Fōrmulæ - Recamán's sequence 04.png]]

'''Case 2. Plotting the sequence'''

[[File:Fōrmulæ - Recamán's sequence 05.png]]

[[File:Fōrmulæ - Recamán's sequence 06.png]]

'''Case 3. Drawing the sequence as it was shown in the Numberphile video'''

[[File:Fōrmulæ - Recamán's sequence 07.png]]

[[File:Fōrmulæ - Recamán's sequence 08.png]]

[[File:Fōrmulæ - Recamán's sequence 09.png]]


=={{header|Go}}==
=={{header|Go}}==