# Hack into a Lottery

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!

• predefined values. pfft – Matthew Roh Feb 21 '17 at 12:29
• can output be a hexadecimal number? – user902383 Feb 21 '17 at 13:25
• @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. – colsw Feb 21 '17 at 14:16
• I love the story lol. More challenges need a backstory like this – Cruncher Feb 22 '17 at 14:40
• So now that there are many solutions to choose from, was the gambling site a fraud? – Tominator Feb 23 '17 at 10:32

# TI-Basic, 10 bytes

9+7
Ans^Ans-0!

• TI-BASIC can't calculate, store or display this number exactly—floats only have 14 digits (about 44 bits) of precision. – lirtosiast Apr 6 '17 at 18:38

# Jelly, 7 bytes

3’*“@‘’


Try it online!

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

## Ruby, 16 12 bytes

p~0^~0>>~077


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

## 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

• p=E/E and f@f[f@p+f@f@p] – Martin Ender Feb 23 '17 at 14:44
• 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 – Martin Ender Feb 23 '17 at 14:55
• 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. – Kelly Lowder Feb 23 '17 at 19:49
• ± 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. – Martin Ender Feb 23 '17 at 21:06

# 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.

# C#, 20 bytes

()=>ulong.MaxValue;

• This is neither a full program nor a function / lambda and therefore invalid. – corvus_192 Feb 21 '17 at 21:27
• 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! – James Feb 21 '17 at 21:34

# Pyth, 9 7 bytes

t^Jyh7J


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.

• I'm sure you know what you can golf down now. – Leaky Nun Apr 30 '17 at 11:20
• @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... – Erik the Outgolfer Apr 30 '17 at 13:41
• It's the same as the previous answer from you wherein I commented. – Leaky Nun Apr 30 '17 at 13:41
• @LeakyNun I found something else too. Golfed. – Erik the Outgolfer Apr 30 '17 at 13:46

# 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.

# Chip, 67 bytes + 3 bytes = 162 70 bytes

(+3 is for flag -w)

*Z~vZZZZvZvvZZZZvZZ-vZZvZZ-ZZvZZt
e*fadc'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.

• This is answer 111111 – anna328p Feb 24 '17 at 0:16
• @wat Oooo so it is :) – Phlarx Feb 24 '17 at 15:45

# 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.

# 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


# 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.

# 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

# JavaScript, 67524745 39 bytes

b=9+7;(b**b+'').substr(0,b)+btoa('×­y')


# C (clang), 26 bytes

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


Try it online!

# Python 2, 21 bytes

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


Try it online!

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

# MathGolf, 3 bytes

Port of the 05AB1E answer. But 1 byte shorter.

♦ó(


Try it online!

# Japt, 17 bytes

GpG s r#È*A+PG+Fs


Try it online!

# MSSQL, 33373029 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

• Source code can't contain 2. – Michael McGriff Feb 21 '17 at 15:31
• @MichaelMcGriff fixed. – Mr Scapegrace Feb 21 '17 at 15:44
• 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. – Neil Feb 21 '17 at 22:47
• @ETHproductions yes, thank you. – Mr Scapegrace Feb 22 '17 at 7:27

## Batch, 645958 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.

# C++, 2624 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.

• Thanks, and i'm sorry for violate the rules. i'm totally new to this site xD – Divcy Feb 23 '17 at 15:01
• 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. – colsw Feb 23 '17 at 16:34
• @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. – Blue Feb 23 '17 at 21:42

# Cardinal 42 bytes

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


Try it Online

# 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.


# Rust, 4342 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.

• I think you can remove the space after the comma. – Conor O'Brien Feb 26 '17 at 4:17
• Oh, beginner mistake! Thanks, updated :) – Wilfred Hughes Feb 26 '17 at 15:31

# ><>, 17 15 bytes

• 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
:*                 Square  ->  16²
:*:*:*           .. another 3 times to make
16¹⁶ = (((16²)²)²)²
i          Push -1 because no input
+         16¹⁶ + (-1) = 16¹⁶-1
n;       Print and Exit


# 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!

# Brain-Flak, 122 bytes

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


Try it online! Also works in Mini-Flak

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

# Java, 92 Bytes :-D

class a{public static void main(String[] a){System.out.print(Long.toUnsignedString(-3/3));}}


# Keg, 6 bytes

\∑\@Ë;


Try it online!

# JavaScript, 34 bytes

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


Works in any console that supports BigInts.