Visualize Recamán's sequence.
0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, ...
Recamán's sequence (A005132 in the OIES) was invented by Bernardo Recamán. It is generated with a simple rule:
"subtract if possible, otherwise add".
Let's look at an example:
- We start with
0
and our step1
0 - 1
is-1
so we add1
and get the sequence0, 1
- We increment the step by one
1 - 2
is-1
so we add2
and get the sequence0, 1, 3
- and so on...
For a good video-explanation, see The Slightly Spooky Recamán Sequence from Numberphile.
Formally, the sequence is defined as follows:
with a0 = 0
By drawing semi-circles to the according terms of the sequence, we receive a nice visualization:
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You will need python3 and pip3 installed on your machine. You can install it from the official website https://www.python.org/. You will also need Tk support. See https://docs.python.org/3/library/tkinter.html for more information.
A step by step series of examples that tell you how to get a virtual python environment running:
Create your virtual environment:
python3 -m venv venv
Then activate your virtual environment:
source venv/bin/activate
To exit the virtual environment run
deactivate
To get started, activate the virtual environment:
source venv/bin/activate
Install the packages from requirements.txt
:
pip3 install -r requirements.txt
After activating the virtual environment, install your package(s)
pip3 install <package>
Then freeze your packages
pip3 freeze > requirements.txt
Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Ulysse McConnell - umcconnell
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.