44
\$\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\$
  • 14
    \$\begingroup\$ predefined values. pfft \$\endgroup\$ – Matthew Roh 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
  • 10
    \$\begingroup\$ I love the story lol. More challenges need a backstory like this \$\endgroup\$ – Cruncher Feb 22 '17 at 14:40
  • 2
    \$\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

72 Answers 72

2
\$\begingroup\$

TI-Basic, 10 bytes

9+7
Ans^Ans-0!
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ TI-BASIC can't calculate, store or display this number exactly—floats only have 14 digits (about 44 bits) of precision. \$\endgroup\$ – lirtosiast Apr 6 '17 at 18:38
2
\$\begingroup\$

Jelly, 7 bytes

3’*“@‘’

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Why does the TIO link have different code? \$\endgroup\$ – Okx Feb 21 '17 at 11:57
  • \$\begingroup\$ @Okx Forgot to update the link, fixed :) \$\endgroup\$ – Ven Feb 21 '17 at 11:59
  • \$\begingroup\$ I think you could do 3’ to get 2. \$\endgroup\$ – ETHproductions Feb 21 '17 at 15:48
  • \$\begingroup\$ @ETHproductions thanks :P. \$\endgroup\$ – Ven Feb 21 '17 at 15:58
2
\$\begingroup\$

Ruby, 16 12 bytes

p~0^~0>>~077

Prints out the number. In REPL mode this would be 11 bytes (without the 'p')

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Mathematica 44 39 Bytes, No numbers

Well I could do the 22 Byte answer Print[(9+7)^(9+7)-3^0]

Here's an answer using addition to build up to the desired number with no numbers in the code:

f=Nest[#+#&,p=E/E,#]&;f@f@(f@p+f@f@p)-p

Saved 5 bytes thanks to @Martin-Ender

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ p=E/E and f@f[f@p+f@f@p] \$\endgroup\$ – Martin Ender Feb 23 '17 at 14:44
  • \$\begingroup\$ Actually, it's shorter to define an operator ± instead of a function f and you can delay assigning p until the Nest is being called: ±x_:=Nest[#+#&,p=E/E,x];±±(±p+±±p)-p \$\endgroup\$ – Martin Ender Feb 23 '17 at 14:55
  • \$\begingroup\$ Thanks for the tips. Incorporating the first two. The ± character eats up 2 bytes, so no savings by that measure, but it costs 3 extra bytes to define. \$\endgroup\$ – Kelly Lowder Feb 23 '17 at 19:49
  • \$\begingroup\$ ± is a single byte in several single-byte code pages e.g. the Windows ANSI code page CP1252, which is actually the default encoding for source files on Windows installations. \$\endgroup\$ – Martin Ender Feb 23 '17 at 21:06
2
\$\begingroup\$

TI-Basic, 14 11 bytes

int(e
Ans^Ans²³-1
  • Many commands in TI-Basic are single or two-byte tokens.

  • The superscript characters are different tokens, so they are allowed.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

C#, 20 bytes

()=>ulong.MaxValue;
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ This is neither a full program nor a function / lambda and therefore invalid. \$\endgroup\$ – corvus_192 Feb 21 '17 at 21:27
  • 1
    \$\begingroup\$ Hello, welcome to the site! As Corvus_192 pointed out, this isn't a full program or function, so it is invalid. If you output this value somehow, the answer will be valid. (For example, print to the console, return from a function, etc.) I'm going to vote to delete this answer for now, but if you edit your answer to be valid, I will retract my vote, or vote to undelete it. You could also [flag] it for a moderator to undelete it. Thanks! \$\endgroup\$ – James Feb 21 '17 at 21:34
2
\$\begingroup\$

Pyth, 9 7 bytes

t^Jyh7J

Online interpreter link.

Uses Emigna's algorithm.

Thanks to Leaky Nun for digging this answer out so that I could -1 it.
-1 because I found yh7 which is shorter than +9 7.

yh7 seems to be the shortest way we can make 16 without using 12468.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I'm sure you know what you can golf down now. \$\endgroup\$ – Leaky Nun Apr 30 '17 at 11:20
  • \$\begingroup\$ @LeakyNun The thing is that I can't use 12468, although this is an answer from when I was inexperienced. Let's see what we've got here... \$\endgroup\$ – Erik the Outgolfer Apr 30 '17 at 13:41
  • \$\begingroup\$ It's the same as the previous answer from you wherein I commented. \$\endgroup\$ – Leaky Nun Apr 30 '17 at 13:41
  • \$\begingroup\$ @LeakyNun I found something else too. Golfed. \$\endgroup\$ – Erik the Outgolfer Apr 30 '17 at 13:46
2
\$\begingroup\$

Pyth, 6 bytes

C*h7"ÿ

Try it online!

How it works

C*h7"ÿ
    "ÿ   creates the string "ÿ" (U+00FF)
  h7     creates 8 (7+1)
 *       generates "ÿÿÿÿÿÿÿÿ"
C        convert to integer from base 256

This works because 18446744073709551615 = 0xFFFFFFFFFFFFFFFF.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Chip, 67 bytes + 3 bytes = 162 70 bytes

(+3 is for flag -w)

*Z~vZZZZvZvvZZZZvZZ-vZZvZZ-ZZvZZt
e*fad`c'`bac^^zba^^bc da^^cabca^c

Try it online!

Chip is a 2D language inspired by integrated circuits, input and output are broken down into individual bits which travel through gates and across wires.

Let's look at the ungolfed version:

*Z~-v-Z-Z-Z-Zv-Zvv-Z-Z-Z-Zvv-Zv-Zvv-Z-Zv-Zv-Zv-Z-Zv-Z-Zvt
e*f a d c c bc abc c c   abc ab abc   ad ac ac a bc a ac

The first portion has two components: *Z~ and e*f. *Z~ creates a 1-cycle pulse to kick off the circuit. e*f is equivalent to the value 0x30, which is the ASCII code for "0".

The remainder of the circuit has one portion for each ASCII digit of the output. For example:

-Zv-
 bc

The elements a, b, c, and d are the low four bits of output: a is 0x01, b is 0x02, and so on. In this sample, we have b and c, giving us 0x02 | 0x04 = 0x06. This combines with the code above to give us 0x30 | 0x06 = 0x36, which is the ASCII code for "6".

The Zs with nothing below them simply result in "0".

At the end, t causes the program to halt.


If instead you want the actual binary value instead, corresponding to eight 0xFF bytes, you can accomplish this in only 22 + 3 = 25 bytes:

a*ZZZZZZZt
dc
*eh
fg*b

The output of this can be verified by e.g. piping it into od -vtu8.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is answer 111111 \$\endgroup\$ – dkudriavtsev Feb 24 '17 at 0:16
  • \$\begingroup\$ @wat Oooo so it is :) \$\endgroup\$ – Phlarx Feb 24 '17 at 15:45
2
\$\begingroup\$

MATL, 7 bytes

I3Z%WZD

Try it online!

Do a typecast on 3 (actual number doesn't matter much) to uint64, which reinterprets the bits of the default double precision float as an unsigned integer, giving a large value. Raise that to the power of 2, overflowing the range of uint64, which makes Matlab clamp it to the upper limit of 18446744073709551615.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

brainfuck, 99 bytes

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

Try it online!

Uses a ternary system for numbers between 0 and 8 (and a little cheat for the 9).

-, - = 0
-, 0 = 1
-, + = 2
0, - = 3
0, 0 = 4
0, + = 5
+, - = 6
+, 0 = 7
+, + = 8
+, ++ = 9
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Stax, 5 bytes

üó|>b

Run and debug it

This is simply the packed version of the program 64|2v which means 2**64-1. Yes, boring.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Brain-Flak, 62 58 bytes

(()())((()()()){}){({}<({({})({}[()])}{})>[()])}{}({}[()])

Try it online!

This runs into a timeout, but here's the "source".

(()())                 init stack with 2
((()()()){}){          repeat 6 times
    (
        {}
        <({({})({}[()])}{})> square the value
        [()]           decrement loop counter
    )
}
{}                     pop 0
({}[()])               decrement value
                       implicitly print it

It calculates ((((((2^2)^2)^2)^2)^2)^2)-1 and prints it

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

JavaScript, 67 52 47 45 39 bytes

b=9+7;(b**b+'').substr(0,b)+btoa('×­y')
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

C (clang), 26 bytes

f(){printf("%llu",-3L/3);}

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Python 2, 21 bytes

print~-(5-3)**(97-33)

Try it online!

5-3 = 2, 97-33 = 64, ~- to decrement.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Japt, 17 bytes

GpG s r#È*A+PG+Fs

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

MSSQL, 33 37 30 29 27 bytes

SELECT power(9.+7,9+7)-77*5

Bigint is too big, so I'm counting 2^64-1 manually. I'm not sure why, but power(2,64) gives 18446744073709552000, so I have to substract 385.

-2 bytes thanks to @ETHproductions

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Source code can't contain 2. \$\endgroup\$ – Michael McGriff Feb 21 '17 at 15:31
  • \$\begingroup\$ @MichaelMcGriff fixed. \$\endgroup\$ – Mr Scapegrace Feb 21 '17 at 15:44
  • \$\begingroup\$ power(2,64) is probably converted from floating-point, and the conversion routines are probably limited by the 17-digit known precision of floating-point values i.e. they can't assume you want exactly 2^64, so they just give you a value which converts to the same floating-point value. \$\endgroup\$ – Neil Feb 21 '17 at 22:47
  • \$\begingroup\$ @ETHproductions yes, thank you. \$\endgroup\$ – Mr Scapegrace Feb 22 '17 at 7:27
1
\$\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.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

C++, 26 24 16 bytes

26 bytes: My first submit

main(){std::cout<<(~0UL);}

[EDIT]24 bytes: () is not necessary

main(){std::cout<<~0UL;}

[EDIT]16 bytes: without main(){}

std::cout<<~0UL;

Obviously, Every c++ program must have an entry point function.

So I think we should not count it as a part of the answer.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks, and i'm sorry for violate the rules. i'm totally new to this site xD \$\endgroup\$ – Divcy Feb 23 '17 at 15:01
  • 1
    \$\begingroup\$ no worries - the site has a couple of things you'll need to get used to, but it's definitely a great way to waste time and have some fun, check out the questions guide and if you have any questions just make a post in the meta forums - best of luck. \$\endgroup\$ – colsw Feb 23 '17 at 16:34
  • 2
    \$\begingroup\$ @ConnorLSW this is not the case, we go as far as allowing answers with exactly the same content as each other (currently at +24/-7). We absolutely encourage users to post answers in the same language as already posted in. \$\endgroup\$ – Blue Feb 23 '17 at 21:42
1
\$\begingroup\$

Cardinal 42 bytes

%+.+=tt.''..*."7"'.."07370955"0+.*t.0+.**.

Try it Online

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

J, 10 bytes

<:JSB^<:5x

JSB is a constant equal to 65536. <: is x - 1. 5x is 5 as an extended integer. ^ is exponentiation.

I spent a really long time working on this. Here are my other solutions:

<:JSB^<:5x
<:^~+:>:7x
<:^~*:<:5x
<:^~*:>:3x
<:^~+:<:9x
<:^~x:JCMPX
<:x:*:*:JSB
<:^~x:%:#a.
#.1x#~*:<:9
<:x:^~>.^^^0
<:x:^~>.^^*_
<:^~<:p:>:5x
<:^~-:x:JBOXED
<:x:^~>.^~^*_
<:x:^~>.^~^^~%_
<:%:*:^:5+:<:9x
<:x:+:+:9!:20''
<:x:^~*:+:+:*__
>:+:#.1x#~#.6#1
<:x:*:*:-:JCHAR2
<:*:*:*:*:+:<:9x
<:x:^~>.%:3 u:EAV
<:x:*:*:3!:0 s:''
<:x:^~>.^^*JCHAR4
<:JCHAR^x:+:JBOXED
<:x:^~>.^^*#dbhelp
<:x:^~>.^^*3 u:DEL
<:x:^~>.^^*#show'show'
<:x:dfh":(>:9)^x:%:#a.
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Rust, 43 42 31 bytes

fn main(){print!("{}",!0usize)}

This isn't portable code (assumes a 64-bit architecture), but I can't use the u64 type due to its name containing forbidden characters.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think you can remove the space after the comma. \$\endgroup\$ – Conor O'Brien Feb 26 '17 at 4:17
  • \$\begingroup\$ Oh, beginner mistake! Thanks, updated :) \$\endgroup\$ – Wilfred Hughes Feb 26 '17 at 15:31
1
\$\begingroup\$

><>, 17 15 bytes

Updates

  • Replaced ab-- with i+ to achieve -1.

b5+:*:*:*:*i+n;

Try it online!

The idea is to factor 1616 into (((162)2)2)2, which can be easily computing by duplicating the stack and multiplying :*.

Explanation

b5+:*:*:*:*i+n;

b                     Push 11
 5                    Push 5
  +                   Add to make 16
   :*                 Square  ->  16²
     :*:*:*           .. another 3 times to make
                           16¹⁶ = (((16²)²)²)²
           i          Push -1 because no input
            +         16¹⁶ + (-1) = 16¹⁶-1
             n;       Print and Exit
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

R, 58 bytes

R has only 32-bit integers, and with 64-bit doubles, the number 18446744073709551615 is not accurately represented, hence this will return a string. I can't even use 64-bit integer packages, because many of them have 64 in the names. Probably not the right tool for the job.

x=as.character((9+7)^(9+7))
n=nchar(x)
substr(x,n,n)='5';x

computes 16^16 and replaces the last character with a 5.

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Brain-Flak, 122 bytes

(()())({({})({}[()])}{})({({})({}[()])}{})({({})({}[()])}{})({({})({}[()])}{})({({})({}[()])}{})({({})({}[()])}{})({}[()])

Try it online! Also works in Mini-Flak

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You can shorten this. Instead of 2^2^2, you can use 4*2*2 to get 16. (((()()()()){}){}). That's 24 Bytes shorter \$\endgroup\$ – Dorian Jul 23 '18 at 14:52
1
\$\begingroup\$

Java, 92 Bytes :-D

class a{public static void main(String[] a){System.out.print(Long.toUnsignedString(-3/3));}}
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

JavaScript, 34 bytes

BigInt(9+7)**BigInt(9+7)-3n**0n+''

Works in any console that supports BigInts.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Cascade, 12 bytes (UTF-8)

#
(
*
*
*
Ā

Try it online!

I can't think of a cleverer way to fold this up that wouldn't kill the squaring. Note that Ā has codepoint 256. Two characters can be shaved off by using 65536 instead, but it comes out to precisely the same byte count:

Cascade, 12 bytes

#
(
*
*
𐀀

Try it online!

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Python, 19 bytes

In REPL

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

Not in REPL

print int('3'*(35-3),7-3)
| improve this answer | |
\$\endgroup\$

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.