login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A172006 Shortest SNUSP representation of a number using only +, - and @ 3
1, 2, 3, 4, 4, 5, 5, 5, 6, 7, 6, 7, 6, 7, 7, 8, 7, 7, 8, 8, 7, 8, 8, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 8, 9, 10, 9, 9, 10, 10, 9, 10, 9, 10, 9, 10, 9, 10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 10, 11, 10, 10, 10, 11, 11, 11, 10, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 12 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

SNUSP is a programming language where each command is an individual letter. The four of concern here are +, -, @ and #. + increments the current data value, - decrements it, @ 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 has four characters before the # so the 5th item in the sequence is 4.

Sequence A172005 is the same as this one but disallows the '-' command. Many values have smaller sequences by allowing the -. There are some sequences that can cut up to two characters off by using the -. I don't know if larger savings are possible or if the savings can become arbitrarily large.

LINKS

Table of n, a(n) for n=1..84.

SNUSP - Esolang

SNUSP Language

EXAMPLE

To produce 10, there are 4 minimal sequences, each of length 7 (as always, excluding the #): +@+++++# ++@@+++# +@++@++# ++@@@++# Thus a(10)=7. The first value that requires a - in its minimal representation is 25 which requires 8 characters. If we disallow the '-' command (as in sequence A172005), it requires 9 characters.

MAPLE

See A172005.

CROSSREFS

Cf. A172005.

Sequence in context: A130233 A131234 A204924 * A172005 A200247 A056791

Adjacent sequences:  A172003 A172004 A172005 * A172007 A172008 A172009

KEYWORD

nonn

AUTHOR

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

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 19 00:12 EST 2019. Contains 329310 sequences. (Running on oeis4.)