Your task, if you choose to accept it, is simple.
Objective
You must make a program that, when run, prints some (as many as you want) terms in a sequence that you choose. The sequence must be a valid OEIS sequence. The twist is that when you take the characters from your code that make up your sequence, string them together and run them in the same language, you should get the formula for the nth of your sequence for your sequence.
Example
Let's say I made this program:
abcdefghij
and chose the sequence of squares: http://oeis.org/A000290
and I chose it to print the first 5 terms of the sequence, the output should be:
1, 4, 9, 16, 25
Note: the output is flexible, you can choose what delimiter you want separating the terms, but the delimiter should be noticeable so that each of the terms of the sequence can be differentiated.
Now, the character at index 1 is a
. The character at index 4 is d
. The character at index 9 is i
. So my new program would be:
adi
and it would have to print the formula for the nth term for my sequence, which is:
n^2
Simple!
Other things
- You must print a minimum of 5 terms.
- You may choose to 0- or 1-index.
- Repeated numbers means repeated characters.
- If your sequence isn't in order (e.g. it goes backwards), then your code still follows it (e.g. your code is written backwards).
- You must use and only use the numbers in bounds of your answer, even if it has already gone out of bounds. You cannot use numbers from the same sequence you did not print.
- If your sequence does not officially have a formula, you may use the first 3 letters of the name stated on the OEIS website (e.g. the fibonacci sequence would print
fib
and the lucas-lehmer sequence would printluc
).
Remember, this is code-golf, so shortest answer, in bytes, wins!
n
? \$\endgroup\$