45
\$\begingroup\$

You've recently made an account on a dodgy gambling site, where for a fee of 25 dollars, they will pay you back a random amount between 0 and 50 dollars. After getting around 5 dollars twice, you decide to prove the site is a scam. After accessing their external firewall with the default password, you find your way onto their database server, and find where the values for the minimum and maximum amounts are held. You decide to plug 25 '9's in as the maximum value, but get an error message saying the maximum value must be of type 'uint64'. However it is now that you notice some number keys don't seem to type into the remote console correctly. The challenge appears before you almost as if typed up on a Q+A site.

using only the conveniently installed programs for testing and executing your particular language, output the maximum size of an unsigned 64-bit integer value, however almost everything except the programming tools are broken on this machine, leaving you without the use of the numbers 1,2,4,6,8 - in either source code or literals, you also notice that it seems to take an exponentially longer amount of time to execute the program for each additional piece of code, so you'd better keep it short if you want to get rich before the drawing!


The Challenge

  • Write a program which outputs 18446744073709551615, the maximum value of an unsigned 64-bit integer, as either a number, or a single string.

  • Your source code cannot contain any of the characters '1','2','4','6' or '8'

  • if your language does not have an unsigned 64-bit integer or equivalent, the output can be in string format or otherwise, but must be the above number.

  • this is so shortest code in each language wins!

\$\endgroup\$
8
  • 14
    \$\begingroup\$ predefined values. pfft \$\endgroup\$ Feb 21 '17 at 12:29
  • \$\begingroup\$ can output be a hexadecimal number? \$\endgroup\$
    – user902383
    Feb 21 '17 at 13:25
  • 1
    \$\begingroup\$ @user902383 must be in the exact format, feel free to parse it as a hex number, as long as the output is in normal decimal notation. \$\endgroup\$
    – colsw
    Feb 21 '17 at 14:16
  • 11
    \$\begingroup\$ I love the story lol. More challenges need a backstory like this \$\endgroup\$
    – Cruncher
    Feb 22 '17 at 14:40
  • 4
    \$\begingroup\$ So now that there are many solutions to choose from, was the gambling site a fraud? \$\endgroup\$
    – Tominator
    Feb 23 '17 at 10:32

78 Answers 78

1 2
3
1
\$\begingroup\$

Attache, 12 bytes

{$`e^$`G-!0}

Try it online!

Uses Attache's inbuilt number compression literals. $`<string> decompresses <string> into a number. In this case, e maps to 4, and G to 32. Another solution would be to replace both with $`q, which maps to 16. We subtract 1, which can be calculated as !0, or \$0!\$. This is a lambda returning the appropriate value.

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

Bash, 27 bytes

printf %u $[57#OSiLrEickbS]

Try it online!

Uses pre-calculated base-57 string. Why base-57? Because anything larger would require one of the prohibited digits.

printf %u $[-3/3]
would also work for 17 bytes, but that’s been done...
\$\endgroup\$
0
0
\$\begingroup\$

Python, 19 bytes

In REPL

int('3'*(35-3),7-3)

Not in REPL

print int('3'*(35-3),7-3)
\$\endgroup\$
0
\$\begingroup\$

Pyke, 5 bytes

Zw`@t

Try it here!

 w`   -   64
Z  @  -  set_bit(0, ^)
    t - ^ -1
\$\endgroup\$
0
\$\begingroup\$

Vim, 41 bytes:

:im a <C-o><C-v><C-a>
i0a7a3a3a5a73a3a073709550a5a0a5

This uses the <C-a> command (increment) to get around the restriction of not using 1, 2, 4, 6, or 8. No TIO link since this doesn't seem to work in V, but it definitely works on vim locally.

\$\endgroup\$
0
\$\begingroup\$

MUMPS, 15 bytes

w 9+7**(9+7)-'0
\$\endgroup\$
0
\$\begingroup\$

SmallTalk – 60 characters

Transcript show:(((7+9)raisedTo:(7+9))-(3/3))printString;cr.
\$\endgroup\$
0
\$\begingroup\$

Batch, 64 59 58 54 bytes

@set a=@cmd/cset/a
%a%0xafebff0
%a%737095
%a%0xc99f

Port of my JavaScript answer. Edit: Saved 5 bytes thanks to @Arnauld.

\$\endgroup\$
0
0
\$\begingroup\$

SmileBASIC, 35 bytes

?POW(!.+!.,#X)LOCATE #A,0?ASC("x")

x should be replaced with CHR$(1615)

\$\endgroup\$
0
\$\begingroup\$

Groovy, 28 Bytes

{++(Long.MAX_VALUE​/0.5​)​}​

Try it: https://groovyconsole.appspot.com/edit/5145694419550208

\$\endgroup\$
0
\$\begingroup\$

Ruby, 18 bytes

p (9+7)**(9+7)-7/7
\$\endgroup\$
1
  • \$\begingroup\$ Would (9+7)**(9+7) save you a byte? \$\endgroup\$
    – Neil
    Feb 21 '17 at 22:49
0
\$\begingroup\$

AWK, 39 bytes

{$0=(a+=++a)^(a*=a*=a*a);sub(".$",5)}1

Usage:

awk '{$0=(a+=++a)^(a*=a*=a*a);sub(".$",5)}5' <<< "anything one line here"

Annoyingly AWK has trouble with integer math beyond 2^53 since it internally converts large integers to 64-bit doubles. Since 2^64 can be exactly represented as a double, its string representation should be exactly 18446744073709551616 (it is on my machine, anyway). Unfortunately, 2^64 - 1 == 2^64, so I could not simply decrement the value, hence the workaround via string substitution.

\$\endgroup\$
0
\$\begingroup\$

asm2bf, 9 bytes

Function body assuming r1 = 0, returns the desired value in r1.

decr1
ret
\$\endgroup\$
0
\$\begingroup\$

Japt, 10 bytes

GîGpG)+#¡5

Try it

GîGpG)+#¡5
G              :16
 î             :Slice the following to that length
  GpG          :  16**16
     )         :End slice
      +        :Append
       #¡5     :1615
\$\endgroup\$
0
\$\begingroup\$

Whitespace, 61 bytes

[S S S T    S N
_Push_2][S N
S _Duplicate][T S S N
_Multiply][S N
S _Duplicate][T S S N
_Multiply][S N
S _Duplicate][T S S N
_Multiply][S N
S _Duplicate][T S S N
_Multiply][S N
S _Duplicate][T S S N
_Multiply][S N
S _Duplicate][T S S N
_Multiply][S S S T  N
_Push_1][T  S S T   _Subtract][T    N
S T _Print_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation:

Pretty straight-forward:

  1. Push 2
  2. Square itself six times
  3. Decrease by 1
  4. Output as integer

Pushing and outputting the expected integer in one go would be 72 bytes instead.

\$\endgroup\$
0
\$\begingroup\$

Julia 1.0, 17 15 bytes

print(~UInt(0))

Try it online!

\$\endgroup\$
0
\$\begingroup\$

x86_64 machine code (Linux), 7 bytes

00000000: 4831 c048 f7d0 c3                        H1.H...

Assembly (NASM):

section .text
global func
func:
xor rax, rax
not rax
ret

Try it online!

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

Python, 20 (or 26) bytes

(5-3)**ord('@')-3**0

ord('@') is equal to 64.

The full function/programme (@BusinessCat, I hope this is more in line with what is expected) would add 6 bytes:

print (5-3)**ord('@')-3**0

The 26 byte version would work if we wanted to pipe the output:

python -c "print (5-3)**ord('@')-3**0"

The 20 byte version would not.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ This is a snippet, every submission needs to be a full program or function. \$\endgroup\$ Feb 27 '17 at 14:19
  • \$\begingroup\$ you can do 3/3 instead of 3**0 and you can remove the space after print to save 2 bytes \$\endgroup\$ May 20 '20 at 9:35
1 2
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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