numberscope / frontscope

Numberscope's front end and user interface: responsible for specifying sequences and defining and displaying visualizers
MIT License
7 stars 15 forks source link

"Count when numbers in integer count" capability #266

Closed OliviaBrobin closed 1 year ago

OliviaBrobin commented 1 year ago

By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.


"Count when numbers in integer count" takes the input sequence and creates a new sequence using an intermediary sequence that it also creates.

Here's an example:

Input sequence: A000040:               2,3,5,7,11, 13 ...

Intermediary sequence:                 2,3,4,5,6,7,8,9,10,11,12,13 ...

Output sequence:                       1,2,2,3,3,4,4,4,4,5,5,6 ...

As you can see, the intermediary sequence is ascending consecutive integer sequence which starts at the first number of the input sequence.

The output sequence then follows the intermediary sequence number by number. If a number in the intermediary sequence is the same as a number in the input sequence, the output sequence increases by one. If a number in the intermediary sequence is not the same as a number in the input sequence, the sequence does not increase.

The inspiration for this is OEIS sequence A000720, which is the output sequence minus the first number.

The images included in the commit demonstrate why I think this is worthwhile to add.

This capability works only for increasing sequences, as to allow for efficient run-times.

\<Please provide a high-level description of your PR.>