27
\$\begingroup\$

When I was a kid, there was a "really cool" shortcut to count to 100:

1, 2, miss a few, 99, 100

Output the exact string above, in the fewest characters possible, without using these characters: 0, 1, 2, 9

\$\endgroup\$
13
  • 5
    \$\begingroup\$ When you say 0, 1, 2, 9, do you mean source is only restricted to not contain ASCII/codepages 48, 49, 50 and 57? \$\endgroup\$
    – 640KB
    Commented Feb 22, 2021 at 15:22
  • 12
    \$\begingroup\$ This is a nice challenge, but be aware that Do X without Y is discouraged because it's often very similar to other challenges with the same premise \$\endgroup\$
    – rydwolf
    Commented Feb 22, 2021 at 16:25
  • 11
    \$\begingroup\$ This does belong on this site, and is on-topic. Redwolf was simply pointing out that Do X without Y often leads to low-quality challenges or duplicates, so it isn't always the best "approach" to have when thinking of a challenge \$\endgroup\$ Commented Feb 22, 2021 at 17:21
  • 13
    \$\begingroup\$ Is x=>'1, 2, miss a few, 99, 100'.normalize('NFKC') a valid submission as it using not 1? \$\endgroup\$
    – tsh
    Commented Feb 23, 2021 at 2:29
  • 31
    \$\begingroup\$ Anyone else grow up with "skip a few"? \$\endgroup\$
    – MooseBoys
    Commented Feb 23, 2021 at 18:13

72 Answers 72

2
\$\begingroup\$

Standard ML (MLton), 65 bytes

print(String.map(fn c=>chr(ord c-3))"4/#5/#plvv#d#ihz/#<</#433");

Try it online!

"4/#5/#plvv#d#ihz/#<</#433" is "1, 2, miss a few, 99, 100" shifted by adding three to each ASCII code. String.map(fn c=>chr(ord c-3)) reverses this shifting by substracting three of each char's ordinal number.

\$\endgroup\$
2
\$\begingroup\$

Yabasic, 46 bytes

?5-4,", ",5-3,", miss a few, ",33*3,", ",5*5*4

Try it online!

Replaced calculated numbers for 1 and 2 with \x hex codes for ASCII 49 and 50 and saved 3 bytes!

(Can't do the above because it results in \x31 and \x32 which of course contain 1 and 2...)

\$\endgroup\$
2
\$\begingroup\$

x86_16 machine code, 146 bytes

Thank's to @mik for tips and trick :))

Replace : add al, "0" / add dl, "0" with add al, 2fh + inc al and add dl, 2fh + inc dl to avoid "0" in the source code.

B3 04          MOV BL, 4
B1 03          MOV CL, 3
2A D9          SUB BL, CL
B4 0E          MOV AH, 0EH
8A C3          MOV AL, BL
04 2F          ADD AL, 2FH
FE C0          INC AL
CD 10          INT 10H
B0 2C          MOV AL, ","
CD 10          INT 10H
80 C3 2F       ADD BL, 2FH
FE C3          INC BL
FE C3          INC BL
8A C3          MOV AL, BL
CD 10          INT 10H
B8 2C 0E       MOV AX, 0E2CH
CD 10          INT 10H
B4 09          MOV AH, 09h
BA 7A 01       MOV DX, OFFSET TXT
CD 21          INT 21H
B8 2C 0E       MOV AX, 0E2CH
CD 10          INT 10H
                                      
B8 20 0E       MOV AX, 0E20H
CD 10          INT 10H
               
B0 21          MOV AL, 33
B3 03          MOV BL, 3
F6 E3          MUL BL
B3 0A          MOV BL, 10
33 C9          XOR CX, CX
           LOOP1:
33 D2          XOR DX, DX
F7 F3          DIV BX
52             PUSH DX
41             INC CX
85 C0          TEST AX, AX
75 F6          JNZ LOOP1
    PRINT_DIGIT1:
5A             POP DX
80 C2 2F       ADD DL, 2FH
FE C2          INC DL
B4 02          MOV AH, 02H
CD 21          INT 21H
E2 F6          LOOP PRINT_DIGIT1
                                      
B8 2C 0E       MOV AX, 0E2CH
CD 10          INT 10H
B8 20 0E       MOV AX, 0E20H
CD 10          INT 10H
                                      
B0 04          MOV AL, 4
B3 05          MOV BL, 5
F6 E3          MUL BL
F6 E3          MUL BL
B3 0A          MOV BL, 10
33 C9          XOR CX, CX
           LOOP2:
33 D2          XOR DX, DX
F7 F3          DIV BX
52             PUSH DX
41             INC CX
85 C0          TEST AX, AX
75 F6          JNZ LOOP2
    PRINT_DIGIT2:
5A             POP DX
80 C2 2F       ADD DL, 2FH
FE C2          INC DL
B4 02          MOV AH, 02H
CD 21          INT 21H
E2 F6          LOOP PRINT_DIGIT2
            EXIT:
B8 00 4C       MOV AX, 4C00H
CD 21          INT 21H
                                                                              
20 6D 69 73 73 20 61 20 66 65 77 24   TXT DB " miss a few$"

Run is DOSBox :

enter image description here

\$\endgroup\$
3
  • 1
    \$\begingroup\$ 0 appears in the code (ASCII 30) \$\endgroup\$
    – mik
    Commented Mar 6, 2021 at 7:53
  • 1
    \$\begingroup\$ the goal of this challenge is to avoid such constructions, you can e.g. add 2fh and then increment \$\endgroup\$
    – mik
    Commented Mar 6, 2021 at 10:42
  • \$\begingroup\$ @mik Thank's for tips and trick :)) I edited my answer now \$\endgroup\$ Commented Mar 6, 2021 at 11:33
2
\$\begingroup\$

Elixir, 58 49 bytes

[?b-?a,?c-?a,"miss a few",?c,?d]|>Enum.join(", ")

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Javascript (ES6), 70 bytes

Old 75:

a=8-7;b=8-6;c=8-8;d=4+5;_=>`${a}, ${b}, miss a few, ${d}${d}, ${a}${c}${c}`

New 50:

_=>[8-7,8-6,'miss a few',(4+5)*(5+5)+4+5,(8-7)*(55+55-5-5)].join(', ')

by far not the best js answer, ill widdle.

\$\endgroup\$
2
+50
\$\begingroup\$

factor, 66 61 bytes

Shaved 5 bytes thanks to @Bubbler!

4 3 - 5 3 - 33 3 * CHAR: d "%d, %d, miss a few, %d, %d"printf

Try it online!

Original version:

4 3 - 5 3 - 33 3 * dup 3 - 4 + "%d, %d, miss a few, %d, %d" printf

My first factor line. Probably can be shorter…

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ You're using 0 in 0x63 and 0x64. \$\endgroup\$
    – Bubbler
    Commented Mar 15, 2021 at 7:46
  • \$\begingroup\$ @Bubbler ha I missed it.. fixed now, but it is even longer.. \$\endgroup\$
    – hdrz
    Commented Mar 15, 2021 at 10:26
  • \$\begingroup\$ You can use CHAR: d for 100, and you can omit a space after string literals. (61 bytes) \$\endgroup\$
    – Bubbler
    Commented Mar 19, 2021 at 6:17
2
\$\begingroup\$

CJam, 28 26 25 bytes

Two bytes off thanks to @Lyxal, and one off thanks to @Lynn!

XY"miss a fewc")i_)]", "*

Try it online!

Explanation

X              e# Push contents of variable X (predefined value): 1
Y              e# Push contents of variable Y (predefined value): 2
"miss a fewc"  e# Push this string
)              e# Detach the last character from that string
i              e# Convert to integer: gives 99
_)             e# Duplicate, increment: gives 100
]              e# Concatenate stack contents into an array
", "           e# Push this string 
*              e# Join the array entries with the specified string
               e# Implicit display 
\$\endgroup\$
4
  • 1
    \$\begingroup\$ 26 bytes (I golfed my golfing suggestion xD) \$\endgroup\$
    – lyxal
    Commented Feb 23, 2021 at 6:09
  • 1
    \$\begingroup\$ Maybe XY"miss a fewc")i_)]", "* for 25? Or also XY"miss a few"9B*_)]", "* \$\endgroup\$
    – lynn
    Commented Jun 21, 2021 at 14:46
  • 1
    \$\begingroup\$ Oops, my bad, you actually have to use the first one because the second one has a 9 in it (facepalm) \$\endgroup\$
    – lynn
    Commented Jun 21, 2021 at 15:53
  • \$\begingroup\$ @Lynn Heh, I didn't remember that requirement. Thanks again! \$\endgroup\$
    – Luis Mendo
    Commented Jun 21, 2021 at 15:54
1
\$\begingroup\$

Zsh, 47 bytes

Not very creative. Oh well.

echo $[3/3], $[6/3], miss a few, $[##c], $[##d]

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Charcoal, 21 bytes

”'3?Sxv7´D|λ*§ξ¬E‹Dαg

Try it online! Compression again. Best I could do without compression is 23 bytes:

⪫⟦LψLχmiss a few℅c℅d⟧, 

Try it online! Link is to verbose version of code.

\$\endgroup\$
1
\$\begingroup\$

PHP, 30 bytes

This contains unprintables so the link is to a Bash program that reconstructs the file and validates it.

<?=~.........................;

Try it online!

Explanation

prints the bitflipped (~) string 1, 2, miss a few, 99, 100.

\$\endgroup\$
1
\$\begingroup\$

Rust, 68 Bytes

fn main(){print!("{}, {}, miss a few, {}, {}",4-3,5-3,66+33,63+37)}

This is my first attempt at code golf Yahoo! Try it online

Rust, 56 bytes

Cutting out the main{} on tio saves 12 bytes

print!("{}, {}, miss a few, {}, {}",4-3,5-3,66+33,63+37)

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to the site, and nice first answer! Be sure to check out our Tips for golfing in Rust page for ways you can golf your program, and we hope you enjoy your time on the site! \$\endgroup\$ Commented Mar 9, 2021 at 16:02
  • \$\begingroup\$ Thanks for the welcome! I'm just having fun with restricted source, I'm not looking to be very competitive! \$\endgroup\$ Commented Mar 9, 2021 at 16:10
1
\$\begingroup\$

BRASCA, 41 36 bytes

`<0x01>, <0x02>, miss a few, `I,[o]H{n` ,`ooHn

Replace <0x01> and <0x02> with ascii codepoints 1 and 2.

Try it!

\$\endgroup\$
1
\$\begingroup\$

AWK, 53 bytes

$a=++x", "++x", miss a few, "(z=(++y y)-x)z", "++z--y

Try it online!

This abuses a couple of AWK language features, including that all variables are initialized to blank/0/False (context sensitive), that it will happily convert strings to numeric values to make an arithmetic operator work, and it will also convert numeric values to strings in order to append characters to it.

First it gets 1, by incrementing variable x

++x", "

then 2, miss a few, just does the same thing again...

++x", miss a few, "

getting a 9 is a bit more work,

(++y y)-x

which works by getting a 1 with ++y then appended it to itself to get 11 then subtracting 2 with -x.

Using that to set the variable z means we can appended another 9 on the end with,

(z=...)z

That just leaves the last bit , 100 which we can get by incrementing the 9 and appending to that 1 decremented.

", "++z--y

I'm pretty sure there are other ways to do this in AWK that are shorter, but I like that this doesn't use any numbers.

One last thing I forgo to mention... The string is printed since,

$a=...

is interpreted as $0=... which evaluates to True, causing AWK print the value of $0, which was just set to the output we want.

\$\endgroup\$
7
  • \$\begingroup\$ I think assuming input to be "" is not correct, you can only assume an empty input. \$\endgroup\$
    – mik
    Commented Apr 13, 2021 at 9:21
  • \$\begingroup\$ That might have been a bad assumption on my part (that it was OK to send empty input), so I asked a comment to clarify. I don't see anything about input in the original question or the comments added. \$\endgroup\$
    – cnamejj
    Commented Apr 14, 2021 at 0:18
  • \$\begingroup\$ but you are passing two quotes as input, and not an empty string \$\endgroup\$
    – mik
    Commented Apr 14, 2021 at 7:51
  • \$\begingroup\$ An empty string works too, I don't know how to do that in TIO \$\endgroup\$
    – cnamejj
    Commented Apr 14, 2021 at 7:54
  • 1
    \$\begingroup\$ for me empty string does not work \$\endgroup\$
    – mik
    Commented Apr 14, 2021 at 9:14
1
\$\begingroup\$

APL (Dyalog Unicode), 45 bytes

(5↓7⌽∊'miss a few, ',⍨(', ',⍨⍕)¨5↑(3-5)⌽⍳77+!4)

 5↓ ⍝ Drop the first 5 elements
   7⌽ ⍝ Rotate left 7
     ∊'miss a few, ', ⍝ Concatenate and enlist
       ⍨ ⍝ Swap arguments
         (', ',⍨⍕)¨ ⍝ Encode as character and concatenate after swapping arguments
           5↑ ⍝ Take the first 5 elements
             (3-5)⌽ ⍝ Rotate right 2
               ⍳77+!4 ⍝ Create range from 0–100 inclusive

Try it online!

\$\endgroup\$
1
\$\begingroup\$

GolfScript, 34 bytes

!.)', ':c.@\'miss a few'3c\33*.c\)

Try it online!

!                                   Push 1 to the stack.
 .)                                 Copy the 1 and increment.
   ',':c                            Define c as ', ' to save characters when commas are needed.
        .@\                         Copy the ', ' and move stuff around into the right order.
           'miss a few'             Push the string to the stack.
                       3c\          Push 3 and ', ' then swap them.
                          33*       Multiply 3*33 to get 99.
                             .c\)   Copy the 99, push ', ' then swap them and increment the last 99.
\$\endgroup\$
1
\$\begingroup\$

Arn, 22 bytes

˜▒çc>åžî¼#(¸“├)øW§Ò┴Ì"

Try it!

Explained

Just the string literal. Pretty boring, the next-shortest I could get without this was 29 bytes.

\$\endgroup\$
1
\$\begingroup\$

PHP, 69 bytes

<?=55-54,', ',floor((5*4)/7),', ','miss a few ',64746/654,', ',5*5*4;
\$\endgroup\$
0
1
\$\begingroup\$

Scratch, 110 bytes

Try it online!

Easy sauce. Alternatively, 12 blocks.

when gf clicked
say(join((4)-(3))(join[, ](join((5)-(3))(join[, miss a few, ](join((3)*(33))(join[, ]((66)+(34
\$\endgroup\$
1
\$\begingroup\$

Deadfish~, 187 178 bytes

{iiiii}dcdddddc{d}ddc{ii}ddcddddddc{d}ddc{{i}dd}dddcddddc{i}cc{{d}ii}dddc{{i}dddd}iiiiic{{d}iiii}dddddc{{i}ddd}cdc{i}{i}ddc{{d}iii}dddddc{d}ddc{ii}iiiiicc{d}dddc{d}ddc{ii}dddcdcc

The previous version was bad.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ 184 bytes: Try it online! \$\endgroup\$ Commented Apr 12, 2021 at 16:11
  • \$\begingroup\$ @astonearachnid This was made using my old generator, which was bad. Thanks! I fixed some stuff. \$\endgroup\$
    – emanresu A
    Commented Apr 13, 2021 at 5:20
1
\$\begingroup\$

AWK, 49 bytes

END{print++x", "5-3", miss a few, "3*33", "4*5*5}

Assuming empty input (otherwise change END to BEGIN for a 51-byte answer).

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Python 3, 56 bytes

lambda:f"{3//3}, {8//4}, miss a few, {3*4*8+3}, {4*5*5}"

Try it online! Uses basic math and an f-string to get the job done.

\$\endgroup\$
1
\$\begingroup\$

Japt, 22 bytes

Cì p`ÚÍ a few`#cL qSi,

Test it

Cì p`...`#cL qSi,
C                     :12
 ì                    :To digit array
   p                  :Push
    `...`             :  Compressed string "miss a few"
         #c           :  Charcode of "c" (99)
           L          :  100
             q        :Join with
              S       :  Space
               i,     :  Prepended with a comma
\$\endgroup\$
1
\$\begingroup\$

Haskell, 54 bytes

p=pred
main=putStr$p.p.p<$>"4/#5/#plvv#d#ihz/#<</#433"

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Pip, 23 bytes

[o#k"miss a few"h+vh]Jk

Try it online!

having a builtin for , is sadly not enough

-3 bytes from DLosc.

\$\endgroup\$
1
\$\begingroup\$

MathGolf, 23 22 bytes

)└"miss a few"♀┐\]û, u

Try it online.

Explanation:

)                      # +1 (since the stack is empty, it'll use an implicit 0)
 └                     # Push the top of the stack + 1 (without popping)
  "miss a few"         # Push string "miss a few"
              ♀        # Push 100
               ┐       # Push the top of the stack - 1 (without popping)
                \      # Swap the top two values on the stack
                 ]     # Wrap all values on the stack into a list
                  û,   # Push string ", "
                     u # Join the list with this ", " as delimiter
                       # (after which the entire stack is output implicitly as result)

Even if we were allowed to use 0129, the byte-count would remain the same (the )└ could simply be 12).

\$\endgroup\$
1
\$\begingroup\$

Java (JDK), 52 bytes

i->4-3+", "+(5-3)+", miss a few, "+(33*3+", "+5*5*4)

Try it online!

\$\endgroup\$
1
\$\begingroup\$

><>, 44 bytes

68*:77*' ,>'5-:' ,wef a ssim ,':6+' ,':5+>o<

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Knight, 50 bytes

O+++++++''-6 5', '-6 4', miss a few, 'A'c'', 'A'd'

Try It Online!

Probably not optimal but whatever.

\$\endgroup\$
1
\$\begingroup\$

GNU dc, 41 bytes

Kzn[, ]nzzn[, miss a few, ]n33z*dn[, ]n+n

Try it online!

\$\endgroup\$
1
\$\begingroup\$

YASEPL, 60 54 chars

=a)commaſspace=b$48+›#a+›#a#"miss a few"#a+7››#a-8›-››

if you're wondering, this is a pretty stupid esolang I made a while ago in Node.JS

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.