# Outputting x to y

## Challenge

You must choose one number x (y = x + 9) and create ten unique programs which each print out one of the numbers in the range x to y inclusive. However, there are three twists:

• Each program's score is the difference between length of your program in bytes and n (where n is the number that the program outputs). i.e. If a program is 12 bytes long and it outputs the number 15, its score is 3 (|15-12| = 3).
• You must not use comments to achieve this byte count.
• Your program must not contain any number which is contained within the number which the program outputs. i.e. If a program outputs 1659, the program cannot contain 1, 6, 5 or 9
• Your program must not contain any of the characters which are the first letters of the number which the program outpts. i.e. If the program outputs 1659, the program cannot contain o, s, f or n (one, six, five and nine)

## Rules

If any number is impossible, this is counted as a DNP. You should declare all DNPs in your range.

The following is a list of numbers and their spellings. The disallowed characters for each are highlighted in bold:

• 0: Zero
• 1: One
• 2: Two
• 3: Three
• 4: Four
• 5: Five
• 6: Six
• 7: Seven
• 8: Eight
• 9: Nine

## Scoring

Your overall score is the sum of all your programs' scores.

## Winning

The person with the lowest score with the fewest DNPs wins.

In the event of a tie, the person whose last edit was earliest wins.

• Do I understand right that I can choose n=1000000 (one million), write programs that output 1000000 to 1000009 without the banned letters or digits, and then pad them to the required length using anything other than comments? – xnor Sep 3 '16 at 9:49
• @xnor Unfortunately, yes. – Beta Decay Sep 3 '16 at 9:50
• Can we output numbers in base 1, i.e. unary? – nimi Sep 3 '16 at 9:53
• @nimi Yes, but only if it's your language's native format. So, Retina can output in unary, but Python cannot – Beta Decay Sep 3 '16 at 9:54
• @Dennis I disagree with lowest x as that would make it impossible for non-golfing languages to compete (which actually could be competitive here due to the scoring mechanism). Unfortunately we haven't seen any such answers yet, but I feel like they have the potential of being really interesting. Tie-break by first wasn't the best idea either and I'm not sure what would have been a good tie-breaker. – Emigna Sep 4 '16 at 9:28

# 05AB1E, score = 0

Chosen x = 1

Programs

1: Variable initialized as 1

X


2: zeroth prime number

0Ø


3: first digit of 2^15

žG¬


4: integer root of 16

žvtï


5: first digit of pi + 2

žqS¬Ì


6: first digit of 2nd to last set from the powerset of 256

žzœ¨¤¬


7: the (e // e)th primeth prime

žržr÷ØØ


8: the first 2 digits of the sum of the 10 first multiples of 3, divided by 2

TLx+O¨Y÷


9: ceil(sqrt(sum(range[1..10])))+2 XOR 1st prime

TLOtîÌXØ^


10: int(prod([1..9])/2^15)-1

žmS¨PžG/ï<


# brainfuck, score = 0

Chosen x = 15

15

+++[>+++++<-]>.


16

+++[>+++++<-]>+.


17

>+[>-[-<]>>]>+-+.


18

+++[>++++++<-]>+-.


19

+++[>++++++<-]>++-.


20

++++[>+++++<-]>+-+-.


21

+++[>+++++++<-]>++--.


22

+++[>+++++++<-]>+--++.


23

>-[++++[<]>->+]<+++---.


24

+++++[>+++++<-]>++----+.


Output is in byte values.

# Jelly, score 0

x=3, using ten completely different methods

2ÆN          -  3: second prime
6ḃ2S         -  4: sum of digits of 6 in bijective-base 2
2*4BL        -  5: number of bits in 16
2+1R+/       -  6: third triangle number
⁵×ØeḞDṪ      -  7: 1st decimal place of Euler's number
12,6_/+2     -  8: Number of vertices on a cube
ȷ*4×ØPḞDṪ    -  9: the 12th decimal place of pi
9999b9999Ḍ   - 10: decimal of 9999 base 9999
45683g38654  - 11: greatest common divisor of 45683 and its reverse
6RLRL×7RLÆfS - 12: sum of the prime factors of 42 (6*7 is the ultimate question)


Run all ten at TryItOnline

Previous (just another boring answer)

x=2

1‘          - 1 incremented            1+1 =  2
1‘‘         - 1 incremented twice    1+1+1 =  3
1‘‘‘        - 1 incremented thrice 1+1+1+1 =  4
1‘‘‘‘       -                ... 1+1+1+1+1 =  5
1‘‘‘‘‘      -              ... 1+1+1+1+1+1 =  6
1‘‘‘‘‘‘     -            ... 1+1+1+1+1+1+1 =  7
1‘‘‘‘‘‘‘    -          ... 1+1+1+1+1+1+1+1 =  8
1‘‘‘‘‘‘‘    -        ... 1+1+1+1+1+1+1+1+1 =  9
3‘‘‘‘‘‘‘‘’  - 3 incremented eight times then decremented
3+1+1+1+1+1+1+1+1-1 = 10
3‘‘‘‘‘‘‘‘‘’ - 3 incremented nine times then decremented
3+1+1+1+1+1+1+1+1+1-1 = 11


If tie-break is on lowest x then for x=0

          - 0: empty program returns zero
¬         - 1: logical not
¬‘        - 2: logical not then increment
¬‘‘       - 3: logical not then increment twice
¬‘‘‘      - 4: logical not then increment thrice
¬‘‘‘‘     - 5: logical not then increment four times
¬‘‘‘‘‘    - 6: logical not then increment five times
¬‘‘‘‘‘‘   - 7: logical not then increment six times
¬‘‘‘‘‘‘‘  - 8: logical not then increment seven times
¬‘‘‘‘‘‘‘‘ - 9: logical not then increment eight times


Run all ten at TryItOnline

• Nice ones! It was answers like these I was hoping to see more of on this challenge. – Emigna Sep 3 '16 at 17:32
• +1 for going the extra mile and making interesting answers :) – Beta Decay Sep 4 '16 at 0:12
• @Emigna yeah, I think the idea of "unique" probably should have been specified somehow as being essentially different (although I'm not quite sure how - I have used the same operators and literals in multiple programs. banning that would make for an interesting twist, although it would exclude some languages) – Jonathan Allan Sep 4 '16 at 0:12
• For x=0, you can also do Unary (using ‘ instead of ¬). – Erik the Outgolfer Sep 18 '16 at 10:58

# Python 2, score 0

x = 14

print +2*3+3+5
print 6+2*3+3+0
print 7+2*3+3+00
print 6+2*3+5+0+0
print-~6+2*3+5+0+0
exec"pri\x6et 22-3"
exec"prin\164 9+8+3"
exec"prin\x74 9+9+03"
exec"prin\164-~9+8+04"
exec"prin\164-~9-~8+04"


# Emotinomicon, 205 bytes

x = 16

😒😉😘😨
😭71😲 ⏬⏬
😭81😲 ⏬ ⏬
😭91😲⏪⏬⏩
😭02😲⏬⏬ ℹ
😭12😲⏬⏬ ℹ
😭22😲⏪⏬⏬⏩
😭32😲 ⏪⏬⏬⏩
😭42😲⏬⏬😊😊
😗😣😨ℹℹ➕😊


Pro tip: Prepend a 😷 before each snippet to clean the output.

### Pyke, x=2, score 0

1h
1hh
1hhh
1hhhh
1hhhhh
1hhhhhh
1hhhhhhh
1hhhhhhhh
ZOhhhhhhhh
ZOhhhhhhhhh


# Mathematica, x = 4, score 0

3+1&
4+01&
5+001&
6+0001&
7+00001&
8+000001&
8+2+22-22&
9+00000002&
9+000000003&
9+0000000004&


Anonymous functions. Take no input and return numbers as output.

### Pyth, x=2, score 0

h1
hh1
hhh1
hhhh1
hhhhh1
hhhhhh1
hhhhhhh1
hhhhhhhh1
hhhhhhyyld
hhhhhhhyyld


# PHP 7 , x=4,score=0

2+2;
11-6;
18-12;
3+2**2;
2+2+2+2;
3+2**2+2;
2+2+2+2+2;
3+2**2+2+2;
3*3+3+6-3-3;
4**2-5+2+0*2;


## Ru, score = 0

x = 2

’1
’’1
’’’1
’’’’1
’’’’’1
’’’’’’1
’’’’’’’1
’’’’’’’’1
→’’’’’’’’2
→’’’’’’’’’2


## dc, x = 5, score 0

# Note: in dc all numbers typed in use the input radix. By default it is 10, which
#means that a number like CF is not 207, but 12*10^1 + 15*10^0 = 135.

CCDap              # 5   print character with the ASCII code  (1333 % 256 =) 53
CCEadp             # 6   print character with the ASCII code  (1334 % 256 =) 54
CCFaddp            # 7   print character with the ASCII code  (1335 % 256 =) 55
ACBAaddp           # 8   print character with the ASCII code (11320 % 256 =) 56
ACBBadddp          # 9   print character with the ASCII code (11321 % 256 =) 57
Addddddddp         #10   print 10 (A)
Bdddddddddp        #11   print 11 (B)
Cddddddddddp       #12   print 12 (C)
Ddddddddddddp      #13   print 13 (D)
Eddddddddddddp     #14   print 14 (E)


Comments were added for a better understanding. All the above 10 programs are standalone, but you could have a bonus program that prints all the numbers from 5 to 14, by copy-pasting each code into one single file.