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
print(String.map(fn c=>chr(ord c-3))"4/#5/#plvv#d#ihz/#<</#433");
"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 ord
inal number.
?5-4,", ",5-3,", miss a few, ",33*3,", ",5*5*4
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...)
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 :
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.
Shaved 5 bytes thanks to @Bubbler!
4 3 - 5 3 - 33 3 * CHAR: d "%d, %d, miss a few, %d, %d"printf
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…
0x63
and 0x64
.
\$\endgroup\$
CHAR: d
for 100, and you can omit a space after string literals. (61 bytes)
\$\endgroup\$
Two bytes off thanks to @Lyxal, and one off thanks to @Lynn!
XY"miss a fewc")i_)]", "*
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
XY"miss a fewc")i_)]", "*
for 25? Or also XY"miss a few"9B*_)]", "*
\$\endgroup\$
9
in it (facepalm)
\$\endgroup\$
Not very creative. Oh well.
echo $[3/3], $[6/3], miss a few, $[##c], $[##d]
”'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.
This contains unprintables so the link is to a Bash program that reconstructs the file and validates it.
<?=~.........................;
print
s the bitflipped (~
) string 1, 2, miss a few, 99, 100
.
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
Cutting out the main{} on tio saves 12 bytes
print!("{}, {}, miss a few, {}, {}",4-3,5-3,66+33,63+37)
`<0x01>, <0x02>, miss a few, `I,[o]H{n` ,`ooHn
Replace <0x01> and <0x02> with ascii codepoints 1 and 2.
$a=++x", "++x", miss a few, "(z=(++y y)-x)z", "++z--y
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.
""
is not correct, you can only assume an empty input.
\$\endgroup\$
(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
!.)', ':c.@\'miss a few'3c\33*.c\)
! 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.
<?=55-54,', ',floor((5*4)/7),', ','miss a few ',64746/654,', ',5*5*4;
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
{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.
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).
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.
[o#k"miss a few"h+vh]Jk
having a builtin for ,
is sadly not enough
-3 bytes from DLosc.
)└"miss a few"♀┐\]û, u
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
).
O+++++++''-6 5', '-6 4', miss a few, 'A'c'', 'A'd'
Probably not optimal but whatever.
=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
0
,1
,2
,9
, do you mean source is only restricted to not contain ASCII/codepages48
,49
,50
and57
? \$\endgroup\$x=>'1, 2, miss a few, 99, 100'.normalize('NFKC')
a valid submission as it using1
not1
? \$\endgroup\$