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

22
\$\begingroup\$

JavaScript (ES6), 43 bytes

Browser only.

_=>atob`MSwgMiwgbWlzcyBhIGZldywgOTksIDEwMA`

Try it online! (with a polyfill)


JavaScript (ES6), 45 bytes

_=>[4-3,5-3,'miss a few',33*3,5*5*4].join`, `

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ I tried to see if I could come up with some thing shorter, but I'm out by quite a lot (and not got splice working as I'd hoped), but I wonder if you could do anything with _=>[..."45x67"].map((c,i)=>i>=3?+(6+c)+33:c-3) \$\endgroup\$ Commented Feb 24, 2021 at 20:58
  • 1
    \$\begingroup\$ @Pureferret Still far too long, but here is a shorter one. \$\endgroup\$
    – Arnauld
    Commented Feb 24, 2021 at 21:54
  • \$\begingroup\$ wow that's neat, thanks. Another idea was to use charPointAt on the string 'miss a few' or use pi for strings, but again too long. \$\endgroup\$ Commented Feb 24, 2021 at 23:22
17
\$\begingroup\$

Bash + coreutils, 40

tr 3-? /-:<<<"5, 6, miss a few, ==, 544"

Try it online!

\$\endgroup\$
7
  • 2
    \$\begingroup\$ I really like this. \$\endgroup\$
    – Jonah
    Commented Feb 22, 2021 at 19:37
  • 1
    \$\begingroup\$ Looks like wildcard expansion on '?': what's the environmental constraint? \$\endgroup\$
    – Joshua
    Commented Feb 23, 2021 at 2:05
  • 1
    \$\begingroup\$ @Will: And if I have a file called 3-1? \$\endgroup\$
    – Joshua
    Commented Feb 23, 2021 at 3:59
  • 3
    \$\begingroup\$ @Joshua, there is an Assumptions about the working directory answer in the What assumptions about the file system layout can be made? meta discussion, saying “The present working directory may be assumed to be empty.” So we ignore the possible presence of such files. \$\endgroup\$
    – manatwork
    Commented Feb 23, 2021 at 4:07
  • 1
    \$\begingroup\$ @Joshua I guess 3-@ would work with the same byte count and no filesystem assumptions. \$\endgroup\$
    – Sisyphus
    Commented Feb 23, 2021 at 5:47
14
\$\begingroup\$

R, 43 41 bytes

cat(T+F:T,"miss a few",3*33+F:T,sep=", ")

Try it online!

T and F are equal to TRUE and FALSE. They get coerced to integers 1 and 0 by the operators + and :.

\$\endgroup\$
2
  • \$\begingroup\$ You can save another 2 bytes by writing 99:100 as 66:67+33 \$\endgroup\$
    – Kirill L.
    Commented Feb 22, 2021 at 18:46
  • \$\begingroup\$ @KirillL. Thanks! I was editing in something similar as you commented. \$\endgroup\$ Commented Feb 22, 2021 at 18:47
11
\$\begingroup\$

HTML + CSS, 118 bytes

<c>, <c>, miss a few, <d><d><c>, <c><style>c:before{content:counter(a);counter-increment:a}d{counter-increment:a 48}

\$\endgroup\$
1
  • \$\begingroup\$ &#57 and &#48 may works for 9 and 0. But I'm not getting a shorter solution with these escape sequence. \$\endgroup\$
    – tsh
    Commented Feb 23, 2021 at 3:27
11
\$\begingroup\$

Python 3, 54, 51, 47 42 bytes

Saved 2 bytes thanks to Digial Trauma's suggestion to replace 8*8+35 = 99 with 33*3 = 99.

Saved 1 byte by realizing that I could replace 8*8+36 = 100 with 4*5*5 = 100.

Saved 4 bytes thanks to dingledooper's suggestion to use sep=', ' in the print!

Saved 5 bytes thanks to ovs' suggestion to use bytes objects.

New Answer

print(*b"","miss a few",*b"cd",sep=", ")
The b"" is equivalent to b"\1\2".

Try it online!

Old Answer:

print(f"{4-3}, {6-4}, miss a few, {33*3}, {4*5*5}")

Try it online!

\$\endgroup\$
8
  • \$\begingroup\$ You can replace 8*8+35 with 3*33. \$\endgroup\$ Commented Feb 22, 2021 at 17:51
  • \$\begingroup\$ Thanks, didn't catch that. \$\endgroup\$
    – qwatry
    Commented Feb 22, 2021 at 18:18
  • 1
    \$\begingroup\$ Use print separators for 47 bytes \$\endgroup\$ Commented Feb 22, 2021 at 23:53
  • \$\begingroup\$ You can save a few more bytes with *b"\1\2" and *b"cd": Try it online! \$\endgroup\$
    – ovs
    Commented Feb 23, 2021 at 12:05
  • 1
    \$\begingroup\$ @TigerTV.ru Oh, I see. The b"\1\2" charcaters don't show up in the answer becase they are unprintable. I'll see what I can do to fix this. The Tio links still work though. \$\endgroup\$
    – qwatry
    Commented Feb 23, 2021 at 17:24
10
\$\begingroup\$

Jelly, 23 bytes

3Ṗ,³ṭ’¤j“¤mɗʂɠẉ⁾»W¤j⁾, 

Try it online!

How it works

One thing to note: Jelly has the atom, which prints a string Jelly representation of it's argument. Lists in Jelly do not use [ and ] as open/close markers, instead they consist of comma-separated values:

1,2,3,4,5Ṙ

prints 1,2,3,4,5, unfortunately, without spaces.

3Ṗ,³ṭ’¤j“¤mɗʂɠẉ⁾»W¤j⁾,  - Main link. Takes no arguments
3                       - Yield 3;
 Ṗ                      - Pop from 3, yielding [1, 2]
      ¤                 - Group the previous links into a nilad:
   ³                    -   100
     ’                  -   Decrement; 99
    ṭ                   -   Tack; [99, 100]
  ,                     - Pair; [[1, 2], [99, 100]]
                  ¤     - Group the previous links into a nilad:
        “¤mɗʂɠẉ⁾»       -   The compressed string "miss a few"
                 W      -   Wrap; ["miss a few"]
       j                - Join; [1, 2, ["miss a few"], 99, 100]
                   j⁾,  - Join with ", "; "1, 2, miss a few, 99, 100"
\$\endgroup\$
8
\$\begingroup\$

Ruby, 42 bytes

$><<[3/3,6/3,'miss a few',33*3,5*5*4]*", "

Try it online!

-4 from Jonah. Borrows from Arnauld's answer.

Ruby, 46 44 bytes

$><<"cd".bytes.insert(2,"miss a few")*", "

Try it online!

The three unprintables for codepoints 1, 2 and 3 are in the string containing "cd".

-2 from manatwork. Other version with same bytecount

\$\endgroup\$
4
  • \$\begingroup\$ 42 bytes. 99 / 100 trick thanks to Arnauld. \$\endgroup\$
    – Jonah
    Commented Feb 22, 2021 at 19:17
  • 3
    \$\begingroup\$ For replacing a single “3” .sub() is enough, no need for its global brother. \$\endgroup\$
    – manatwork
    Commented Feb 23, 2021 at 0:44
  • \$\begingroup\$ BTW, without regular expression would be 1 more character shorter, though still longer than Jonah's. Try it online! or Try it online! \$\endgroup\$
    – manatwork
    Commented Feb 23, 2021 at 0:51
  • 1
    \$\begingroup\$ Thanks for your help! @Jonah manatwork \$\endgroup\$
    – Razetime
    Commented Feb 23, 2021 at 3:28
8
\$\begingroup\$

Whispers v3, 124..120 114 bytes

>> Each 5 57
>> Then 7 3 6 3 4 3 54 3 8
> ", "
> "miss a few"
>> "L"
>> #3
>> #5
>> 53*6
>> #4
>> 8-7
>> Output 56

Try it online!

Explanation:

I use the fact that each line with the line number \$x\$ can be called with \$x + k \cdot n \$, where \$k \in \mathbb{N} \$ and \$n\$ is total number of lines of code. Example from code with 11 lines: the reference to line 1 can be replaced by 12, 23, 34, and so on.

Try the translated version online!

Line by line:

As always in Whispers, we run the last line first:

>> Output 56

This line outputs the result from line 56. Since the code does not have 56 lines it actually outputs line \$ 56 \mod 11 = 1\$:

>> Each 5 57

Applying the same trick again we can replace this line with:

>> Each 5 2

In line 5 we can expect a function and in line 2 an array. The function will be applied on each element of the array and it replaces the element with the result. Let us first look at line 5:

>> "L"

L is an argument from the Each statement in line 1. L is converted to a string.

Now line 2:

>> Then 7 3 6 3 4 3 54 3 8

Then creates an array with the arguments as its elements. If we would print this line we get the following array:

[1, ', ', 2, ', ', 'miss a few', ', ', 99, ', ', 100]

Explanation of the arguments:

Line 3 and 4: simple strings

Line 6: Returns the length of line 3, so we get 2

Line 7: Returns the length of line 5, so we get a 1

Line 8: Returns the result of line 53 (actually 9) raised to the power of the result of line 6, so we get 100

Line 54 (actually 10): Subtracts result of line 8 with the result of line 7, so we get a 99

\$\endgroup\$
8
\$\begingroup\$

PHP, 57 56 53 bytes

printf('%c, %d, miss a few, %d, %o',7*7,5-3,33*3,64);

Try it online!

A printf, some spices, stir

EDIT: -1 byte thanks to Digital Trauma

EDIT 2: -3 bytes thanks to Michael Dorgan for octal, thought about 153 with %x for hex but it has a 1..

Also, less fun but 2 bytes shorter by manatwork, improved by BadHorsie (it seems that <?= can also take multiple arguments with comas):

PHP, 51 49 bytes

<?=5-4,', ',5-3,', miss a few, ',33*3,', ',5*5*4;

Try it online!

\$\endgroup\$
8
  • \$\begingroup\$ 5-3 (with %d) is 1 shorter than 47+3 (with %c). \$\endgroup\$ Commented Feb 22, 2021 at 17:49
  • \$\begingroup\$ @DigitalTrauma good catch! \$\endgroup\$
    – Kaddath
    Commented Feb 22, 2021 at 17:53
  • \$\begingroup\$ An echo with simply enumerated parameters would be shorter. Try it online! \$\endgroup\$
    – manatwork
    Commented Feb 23, 2021 at 0:57
  • \$\begingroup\$ From my answer, think "octal" for the 100 (64) :) \$\endgroup\$ Commented Feb 23, 2021 at 1:20
  • 1
    \$\begingroup\$ Use <?= instead of echo to save a couple of bytes. \$\endgroup\$
    – BadHorsie
    Commented Feb 23, 2021 at 12:09
6
\$\begingroup\$

C (gcc), 54 56 bytes

l(){printf("%c, %d, miss a few %d, %o",7*7,5-3,'c',64);}

Try it online!

Let's save a couple bytes using Octal for the 100. Thanks to Sheik Yerbouti for saving a byte and point out the no commas issue.

\$\endgroup\$
5
  • \$\begingroup\$ Using C, I looked at a putchar() alternative, but it isn't all that short, unfortunately: for(char x[]="4/#5/#plvv#d#ihz/#<</#433",*y=x;*y;)putchar(*y++-3); \$\endgroup\$
    – Will
    Commented Feb 23, 2021 at 4:21
  • \$\begingroup\$ I tried really hard to loop, but it just gets too big. Hence using printf qualifiers carefully. \$\endgroup\$ Commented Feb 23, 2021 at 22:16
  • 1
    \$\begingroup\$ @will it is 66 bytes, longer than this one main(i){for(i=5*5;i--;)putchar("334#/<<#/zhi#d#vvlp#/5#/4"[i]-3);} \$\endgroup\$
    – tsh
    Commented Feb 26, 2021 at 12:10
  • \$\begingroup\$ @tsh Nice improvement. I somehow completely overlooked passing the string directly with an index to putchar. Well combined with default int and reverse/decrement indexing too. \$\endgroup\$
    – Will
    Commented Feb 26, 2021 at 15:17
  • \$\begingroup\$ @MichaelDorgan you are missing the commas in the output. Anyway you can save 1 byte by printing 'c' instead of 33*3 \$\endgroup\$
    – anotherOne
    Commented Feb 27, 2021 at 22:18
5
\$\begingroup\$

R, 52 bytes

cat(chartr("@-K","/-:","B, C, miss a few, JJ, BAA"))

Try it online!

Encodes numbers as uppercase letters and then applies character range translation. Since we can't directly type 0-9, we expand the range by 1 character in both directions resulting in /-:.

\$\endgroup\$
5
\$\begingroup\$

brainfuck, 146 bytes

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

Try it online!

A fairly straightforward 255/5=51 loop giving ASCII 51 and ASCII 102 as 333ff in 5 consecutive cells, followed by hunt and peck strategy.

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

Perl 5, 42 bytes

$,=", ";say!!3,5-3,"miss a few",3*33,4*5*5

Sets the record separator, and prints a few numbers and a string.

Try it online!

Perl 5, 43 bytes

say"C, D, miss a few, KK, CBB"=~y,A-L,/-:,r

Translates B-K to 0-9 (extended by one more ASCII code on each side of the range) and prints.

Try it online!

Perl 5, 44 bytes

$,=", ";say unpack"c3/acc","
miss a fewcd"

Sets the record separator, and unpacks values to be printed.

Try it online!

\$\endgroup\$
4
\$\begingroup\$

Julia, 41 bytes

()->join([b"";"miss a few";b"cd"],", ")

Try it online!

the first string is "\1\2" which is allowed if I understand the challenge correctly

b"str" converts the string in an array of the value of each character so b"\1\2" => [1,2] and b"cd" => [99,100]

\$\endgroup\$
4
\$\begingroup\$

Husk, 31 bytes

mȯ←←←"4/#5/#plvv#d#ihz/#<</#433

Try it online!

Explanation:

m                                 Map the function...
 ȯ←←←                             Decrement character 3 times
      "4/#5/#plvv#d#ihz/#<</#433  desired string "ASCII-shifted" by 3
\$\endgroup\$
4
\$\begingroup\$

Jelly, 22 bytes

³ḊĖ.ịṚj“¤mɗʂɠẉ⁾»W¤j⁾, 

A full program that prints the result.

Try it online!

How?

³ḊĖ.ịṚj“¤mɗʂɠẉ⁾»W¤j⁾,  - Link: no arguments
³                      - 100
 Ḋ                     - dequeue -> [2,3,...,99,100]
  Ė                    - enumerate -> [[1,2],[2,3],...,[98,99],[99,100]]
   .                   - 0.5
    ị                  - index into -> [[99,100],[1,2]]
     Ṛ                 - reverse
                 ¤     - nilad followed by links as a nilad:
       “¤mɗʂɠẉ⁾»       -   dictionary compression of "miss a few"
                W      -   wrap in a list  -> ["miss a few"]
      j                - join              -> [1,2,"miss a few",99,100]
                   ⁾,  - ", "
                  j    - join              -> [1,", ",2,", ","miss a few",", ",99,", ",100]
                       - implicit print    -> `1, 2, miss a few, 99, 100`
\$\endgroup\$
0
4
\$\begingroup\$

05AB1E, 16 bytes

I don't think this would be shorter with 0, 1, 2 and 9.

XY…š§€…†Óт<т„, ý

Try it online!

X                # push 1
 Y               # push 2
  …š§€…†Ó        # push compressed dictionary string "miss a few"
         т<      # push 100-1
           т     # push 100
            „,   # push string ", "
               ý # join the stack with this string
\$\endgroup\$
1
  • \$\begingroup\$ Nice, the solution I came up with was the same but starting with ≠x instead of XY. \$\endgroup\$
    – Makonede
    Commented Feb 23, 2021 at 21:42
4
\$\begingroup\$

Stax, 20 19 17 bytes

saved 2 bytes thanks to Razetime

ü←φr5╧wL'•↔♦$▒ò╠‼

Run and debug it


Original brain-dead solution for reference purposes only:

Stax, 22 bytes

ü2Φÿßbÿ»f╙m¡6¿₧|░╘;┬u»

Run and debug it

\$\endgroup\$
1
  • \$\begingroup\$ -2 \$\endgroup\$
    – Razetime
    Commented Feb 23, 2021 at 11:57
4
\$\begingroup\$

C++, 56 bytes

[]{for(int x:"4/#5/#plvv#d#ihz/#<</#433"s)putchar(x-3);}

Inspired by a comment.

Usage:

#include <string>
#include <stdio.h>

using namespace std;

int main() {
    auto k = [](){for(int x:"4/#5/#plvv#d#ihz/#<</#433"s)putchar(x-3);};
    k();
    return 0;
}

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ save 2 bytes by eliminating optional () as []{for(int x:"4/#5/#plvv#d#ihz/#<</#433"s)putchar(x-3);} \$\endgroup\$ Commented Feb 25, 2021 at 5:28
4
\$\begingroup\$

Barrel, 31 34 bytes

+n, +n, 'miss a few, '#44+#45+n, +n

This is my own esolang, follow the link for more info.

Increments the accumulator, prints it, implicitly prints some strings (, and miss a few, are implicitly printed), does a loop on accumulator incrementation, and finishes as it started.

Edit: I realized that "97" used a "9". smacks forehead

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Welcome to Code Golf, and nice first answer! Be sure to check out this deadlineless bounty that offers reputation for showcasing new and interesting languages \$\endgroup\$ Commented Apr 10, 2021 at 23:29
  • \$\begingroup\$ Hi! As caird said, I've got a bounty for new and interesting languages. I'd be willing to give this answer a bounty of +100 reputation, or if you think you could demonstrate more of the language's features in another answer I could award it to that instead. \$\endgroup\$
    – rydwolf
    Commented Apr 10, 2021 at 23:37
  • \$\begingroup\$ @RedwolfPrograms: Cool! <strike>I'd golf this but I'm not sure about it because I'd have to add a feature. Hmmm....</strike> I'm working on something. \$\endgroup\$
    – LorenDB
    Commented Apr 11, 2021 at 1:37
  • \$\begingroup\$ @LorenDB Sounds good, let me know when you've got an answer chosen/posted! \$\endgroup\$
    – rydwolf
    Commented Apr 11, 2021 at 1:48
  • \$\begingroup\$ @RedwolfPrograms: here you go :) codegolf.stackexchange.com/a/223430 \$\endgroup\$
    – LorenDB
    Commented Apr 14, 2021 at 0:34
3
\$\begingroup\$

Retina 0.8.2, 32 bytes


B, C, miss a few, JJ, BAA
T`L`d

Try it online! Explantion:


B, C, miss a few, JJ, BAA

Replace the empty input with the literal string.

T`L`d

Transliterate upper case letters to digits.

\$\endgroup\$
3
\$\begingroup\$

PowerShell (ASCII answer), 128 bytes

$k=3-3;((@(46+3),@(53-3),@('miss a few'),@(57,57),@((46+3),48,48))|%{$k++;if($k-eq3){$_}else{($_|%{[char]$_})-join''}})-join', '

Try it online!

PowerShell (Base64 one), 135 bytes

[Text.Encoding]::Unicode.GetString([Convert]::FromBase64string('MQAsACAAMgAsACAAbQBpAHMAcwAgAGEAIABmAGUAdwAsACAAOQA5ACwAIAAxADAAMAA='))

Try it online!

\$\endgroup\$
6
  • 1
    \$\begingroup\$ @Arnuald edited the code to 3-3 \$\endgroup\$
    – Wasif
    Commented Feb 22, 2021 at 16:12
  • 1
    \$\begingroup\$ A few bytes less? Try it online! \$\endgroup\$ Commented Feb 22, 2021 at 19:29
  • 1
    \$\begingroup\$ Or even less bytes (but a far less interesting answer, unfortunately): Try it online! \$\endgroup\$ Commented Feb 22, 2021 at 19:37
  • 1
    \$\begingroup\$ @ZaelinGoodman thanks, but that is straight copy of Arnauld answer \$\endgroup\$
    – Wasif
    Commented Feb 23, 2021 at 15:29
  • 1
    \$\begingroup\$ Base64 in 100 tio.run/##K8gvTy0qzkjNyfn/… or am I completely overlooking a 0,1,2 or 9? \$\endgroup\$ Commented Feb 23, 2021 at 23:30
3
\$\begingroup\$

Jelly, 23 bytes

“×ƤṪ5Ġpṃ:Ƒ5ṫȷØJkxXp⁺¥ġ»

Try it online!

Same length as caird's answer, much more boring.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I'm glad I found a way to golf from 25 to 23, it would've been disappointing if flat compression won this! \$\endgroup\$ Commented Feb 22, 2021 at 17:22
3
\$\begingroup\$

Python 2, 59 bytes

print ', '.join(map(str,(4-3,5-3,'miss a few',33*3,5*5*4)))

Try it online!

Thanks to @arnauld for js answer

\$\endgroup\$
1
  • \$\begingroup\$ 57 bytes with `` instead of str and 55 bytes by manually placing ,. \$\endgroup\$
    – ovs
    Commented Feb 23, 2021 at 22:13
3
\$\begingroup\$

Pyth, 29 bytes

j+\,d[=hZhZ"miss a few"t=*TTT

Try it online!


Python 3.8 translation:

Z=0
T=10

print(", ".join(map(str,[(Z:=Z+1),Z+1,"miss a few",(T:=T*T)-1,T])))
\$\endgroup\$
3
\$\begingroup\$

PHP, 48 bytes

<?=join(', ',[!'',~-3,'miss a few',33*3,45^73]);

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Vim, 37 keystrokes

i3, 3, miss a few, 8, <esc>|<C-x><C-x>l.l<C-a>ylp$pp<C-a>
\$\endgroup\$
3
\$\begingroup\$

PHP, 58 54 bytes

<?=join(', ',[$i=3/3,++$i,'miss a few',$i=33*3,++$i]);

PHP doesnt really want to be typed short, but I liked coming up with this :)

\$\endgroup\$
3
\$\begingroup\$

Vyxal, 21 20 19 bytes

3ɽ÷«eeȮǒḋp«₁‹₁W‛, j

Try it Online!

Explained

3ɽ÷      # stack = [1, 2]
«eeȮǒḋp« # stack = [1, 2, "miss a few"] 
₁‹₁      # stack = [1, 2, "miss a few", 99, 100]
W‛, j    # join stack on ", "
\$\endgroup\$
3
\$\begingroup\$

Perl 6, 45 bytes

say join ", ",5-4,5-3,"miss a few",3*33,4*5*5

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You can save 1 by dropping the ; at the end. \$\endgroup\$
    – Kjetil S
    Commented Jun 21, 2021 at 16:20

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.