cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A172005 Shortest SNUSP representation of a number using only + and @.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 5, 5, 6, 7, 6, 7, 6, 7, 7, 8, 7, 7, 8, 8, 7, 8, 8, 9, 9, 8, 8, 8, 8, 9, 9, 10, 9, 8, 9, 10, 9, 9, 10, 11, 9, 10, 9, 10, 9, 10, 9, 10, 11, 11, 11, 12, 10, 11, 9, 10, 10, 10, 10, 10, 10, 11, 11, 12, 10, 11, 11, 10, 10, 11, 11, 12, 10, 11, 11, 10, 11, 11, 12, 11, 12, 13, 11, 12
Offset: 1

Views

Author

Darrell Plank (jar_czar(AT)msn.com), Jan 22 2010

Keywords

Comments

SNUSP is a programming language where each command is an individual letter. The two of concern here are + and @ and #. + increments the current data value, @ is a "subroutine call" and # is a "return". When an @ is encountered, a record of the location is put on a stack and execution continues. When a # is encountered, if there is a return point on the stack, the execution continues at that a single character beyond that return point. If there is no return point on the stack, execution terminates.
Thus "@@++#" would put the first two "@" return points on the stack, increment data twice, return from the second "@" to the last "+", increment the data once more, return from the first "@" to the first "+", increment the data two more times and finally terminate when it hits the "#" with no return points on the stack. The data is always initialized to zero so this effectively puts 5 into the data. In order to place a particular value into the data, there is a minimal string of these characters. The i-th element of the sequence gives the minimal number of characters (excluding the "#" which is always the last character) to produce an SNUSP program which sets the data to i. The string above is a minimal string to produce 5 and have four characters before the # so the 5th item in the sequence is 4.
All sequences for values >= 3 end in @++ or +++, both of which are equivalent so there are an even number of sequences for every value, half of which end in +++ and half of which end in @++. There are several variations to this sequence which I'll also enter in. They include allowing "-" to decrement the data, the number of minimal sequences and numbers which require a "-" in their minimal expression.

Examples

			To produce 10, there are 4 minimal sequences, each of length 7 (as always, excluding the #): +@+++++# ++@@+++# +@++@++# ++@@@++# Thus a(10)=7.