Hack into a Lottery

44

8

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!

colsw

Posted 2017-02-21T11:13:58.210

Reputation: 3 195

14predefined values. pfft – Matthew Roh – 2017-02-21T12:29:41.177

can output be a hexadecimal number? – user902383 – 2017-02-21T13:25:59.827

1@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 – 2017-02-21T14:16:44.483

You don't need any constants, e.g. int x, y, z; y = x - x; z = factorial(y); at which point y == 0 and z == 1 from z you can get any number, including the real numbers. I've considered designing a language without digits: e.g. ONE = |{}|! (factorial of cardinality of empty set), then TWO = ONE + ONE, and so on. – None – 2017-02-21T16:40:57.587

What an odd challenge – Frambot – 2017-02-21T21:42:19.753

10I love the story lol. More challenges need a backstory like this – Cruncher – 2017-02-22T14:40:01.083

2So now that there are many solutions to choose from, was the gambling site a fraud? – Tominator – 2017-02-23T10:32:55.167

Relevant XKCD: https://xkcd.com/221/

– David says Reinstate Monica – 2017-02-23T17:26:07.460

Answers

20

Beeswax, 3 bytes

_M{

Explanation:

_   # Create a bee going horizontally across the line, reading the code
 M  # Decrement the bee's counter, which starts at 0.
    # This will set the counter to 2^64-1, because as bees don't have a concept of
    # negative numbers, all values that are negative are translated to 2^64-n,
    # and in this case, n = -1, as we are calculating 0 - 1.
  { # Print the value

Try it online!

This language is perfect for this challenge.

Here is an extract from the Esolang page on Beeswax:

As everyone knows, bees don’t have a concept of negative numbers, but they discovered that they can use the most significant bit of an address to get around that. Thus, coordinates relative to a bee’s position are realized by the two’s complements of the coordinates. This way, half of the 64-bit address space is available for local addressing without wraparound in each direction.

The maximum positive 64-bit two’s complement address is 9223372036854775807 or 0x7fffffffffffffff in 64 bit hex. All values from 0 up to this value translate identically to the same 64 bit value. All values n in the opposite (negative) direction translate to 2^64-n. For example: n=-1 is addressed by 18446744073709551615. n=-9223372036854775808 is addressed by 9223372036854775808.

This is basically unsigned longs.

EDIT: I'm still expecting Dennis to outgolf me with a 2-byte solution.

Okx

Posted 2017-02-21T11:13:58.210

Reputation: 15 025

You don't need to print it if the form will return the value. See other answers. – MatthewRock – 2017-03-24T14:28:07.880

41

C, 26 bytes

main(){printf("%lu",~0l);}

Prints a unsigned long value.

Requires the size of long to be 64 bits.

Ven

Posted 2017-02-21T11:13:58.210

Reputation: 3 382

Nice one. Pretty much the same in Perl: print~0. – Dada – 2017-02-21T11:42:00.120

2~0l should work. – Christoph – 2017-02-21T12:51:38.643

@Christoph thanks! – Ven – 2017-02-21T12:53:08.880

Source code cannot contain the character '1'. – AnixPasBesoin – 2017-02-22T10:17:25.693

11@AnixPasBesoin it's a lowercase 'L' :) – Quentin – 2017-02-22T11:03:32.473

@Quentin ^^ Ah! Sorry! Didn't notice (was using mobile, "l" and "1" looked the same). This post has my upvote now. – AnixPasBesoin – 2017-02-22T11:05:51.657

2You're assuming sizeof(long) * CHAR_BIT == 64. A reasonable assumption for golf, but worth pointing out. – Ray – 2017-02-23T03:11:11.660

Why does this work? What is the behaviour of '~' followed by an integer? – Chris – 2017-02-23T15:18:13.363

1@Chris it's the bitwise not operator. – Ven – 2017-02-23T15:45:20.667

28

CJam (4 bytes)

GG#(

Online demo

This calculates 1616 - 1 using builtin G for 16 and the decrement operator (.

Peter Taylor

Posted 2017-02-21T11:13:58.210

Reputation: 41 901

19Definitely GG! ;) – WasteD – 2017-02-21T13:31:59.123

gg, Peter, gg.. – cascading-style – 2017-02-23T02:20:36.113

28

64-bit SBCL Common Lisp, 18 bytes

most-positive-word

Most positive word on 64-bit compiler is 64uint. It's something.

MatthewRock

Posted 2017-02-21T11:13:58.210

Reputation: 913

7Best syntax :)) – seshoumara – 2017-02-21T14:58:53.497

1Makes me very happy – Stan Strum – 2017-09-12T20:42:40.767

22

Python3 REPL, 12 bytes

In REPL: ~-(~-3<<9*7)

Outside of REPL: print~-(~-3<<9*7) <--> Python2!

Here's another one at 17 bytes: ~-(~-3<<ord("?")).

Explanation

Nothing super fancy. Here's it broken down:

~-           | Subtract 1 from the next value.
  (          | 
   ~-3       | Subtract 1 from 3, resulting in 2
      <<     | Binary shift 2's digits to left,
        9*7  | by 9*7 (63).
           ) | The value inside the parentheses is now 2**64.

The resulting expression is roughly (but not quite) ~-(2<<63) -> (2**64)-1. I use the tadpole operator twice here. A golfing tip about it is here.

There is also sys.maxint in Python2 which can be used, but I won't be looking at that.

repl.it <- testing link.

Yytsi

Posted 2017-02-21T11:13:58.210

Reputation: 3 582

Why does this code look like a cat that ate another cat? – OldBunny2800 – 2017-02-27T20:19:50.203

@OldBunny2800 Is the ~-(~ part the eyes of the first cat? I can't see the second cat well... – Yytsi – 2017-09-15T10:29:24.110

16

bc, 15 13 bytes

Saved 2 bytes thanks to manatwork.

(a=9+7)^a-3/3

Nothing fancy, just (16^16)-1.

Richard

Posted 2017-02-21T11:13:58.210

Reputation: 331

2Welcome to PPCG! – ETHproductions – 2017-02-21T15:37:35.210

1(a=9+7)^a-3/3 – manatwork – 2017-02-23T08:34:25.060

Thanks I was originally doing something like that in bash before I realised my answer was better as pure bc. – Richard – 2017-02-23T09:50:51.900

13

dc, 7 bytes

I think it's allowed for stack based languages to leave the answer on the top cell of the stack, similar to a return value for functions. If explicit printing is needed, add p at the end of the code.

AZ5E^z-

Try it online!

It computes (2 64 - 1) using several tricks:

  • 2 is given as the number of digits (Z) found in integer 10 (A)
  • 64 is given as 5E. By default dc uses 10 as the input radix. Even so, it can accept numbers in hexadecimal notation, but they will be converted differently than you'd expect. Example: (5E)default = (5E)(input radix = 10) = (5 * 10 1) + (14(E) * 10 0) = 50 + 14 = 64

  • 1 is given as the stack's depth (z), since only (2 64) was present then

Alternative story:

However it is now that you notice some number keys don't seem to type into the remote console correctly. You take a deep breath and start testing each numerical key. It is worse than you thought! Not a single one works, and you're left with the task to produce your desired integer by using only letters and symbols.

Solution in dc: computing (16 16 - 1), still 7 bytes!

Fz+d^z-          # push 15, push 1, add, duplicate, exponentiate, push 1, subtract

Try it online!

seshoumara

Posted 2017-02-21T11:13:58.210

Reputation: 2 878

2Great alternative story – cascading-style – 2017-02-23T02:22:19.663

10

05AB1E, 4 bytes

žJn<

Explanation:

žJ   # Push 4294967296
  n  # Squared
   < # Decreased by one

Finally! A chance to use 05AB1E's builtins for powers of two!

Try it online!

Another 4 byte answer:

žxo<

Explanation:

  o  # 2 to the power of
žx   # 64
   < # Decreased by one

Try it online!

(if anyone is wondering, this question is older than all the other 4-byte answers)

Okx

Posted 2017-02-21T11:13:58.210

Reputation: 15 025

I feel like there's a shorter solution along the lines of 64o< but I haven't found it yet. Something like '@Ço< with a creative 64 push... If you manage to push 64 with 1 byte, you can get 3 is the point I'm trying to make. – Magic Octopus Urn – 2017-02-23T19:51:35.190

10

Jelly, 4 bytes

⁴*`’

Try it online!

Explanation

⁴     # 16
 *    # exponentiate
  `   # last link as a monad, repeating the argument
   ’  # decrement

Emigna

Posted 2017-02-21T11:13:58.210

Reputation: 50 798

10

MATLAB / Octave, 5 bytes

@Sanchises posted an excellent MATLAB answer, however this one is a considerably different approach, so I'll post it anyway:

tic/0

In MATLAB, tic returns the number of milliseconds past since the program was opened. Crucially the value it returns is a uint64 type. This gets away from having to cast a number to uint64 from MATLABs default type of double.

Any number divided by 0 in MATLAB is considered as infinity which for non-floating point types, MATLAB represents this as the maximum integer value for that type.


This also works with Octave though depending on which interpreter you use it may spit out a "division by zero" warning as well. You can try the code online here though as I say you get a /0 warning that doesn't appear in MATLAB.

Tom Carpenter

Posted 2017-02-21T11:13:58.210

Reputation: 3 990

Really clever approach, nice one. – colsw – 2017-02-26T15:37:12.583

I'm only seeing this answer now. Very clever! (of course, it does not work if you execute this on a very fast computer such that tic==0 at startup ) – Sanchises – 2018-07-23T07:32:16.230

7

bc, 18, 16 bytes

  • Saved 2 bytes, thx @MrScapegrace
(9-7)^(55+9)-3/3

zeppelin

Posted 2017-02-21T11:13:58.210

Reputation: 7 884

1can you use something like -3/3 to get -1? – Mr Scapegrace – 2017-02-21T15:32:46.197

@MrScapegrace, yep that's a nice idea, thank you ! – zeppelin – 2017-02-21T15:34:22.833

@boboquack 55+9 = 64, not 63! – JakeSteam – 2017-02-22T10:54:46.523

7

PHP, 16 bytes

This is much like the answer from Ven: https://codegolf.stackexchange.com/a/110751/38505

printf("%u",~0);

https://repl.it/Frcy/0

For this to work, you need to be in a 64-bit architecture. This is because ~0 is -1, which is 111111111111111111111111111111111111111111111111111111111111‌​1111 in binary, in 64 bits, compared to 11111111111111111111111111111111 in 32-bits, and the numbers are plataform-dependent - Ismael Miguel

ʰᵈˑ

Posted 2017-02-21T11:13:58.210

Reputation: 1 426

1Lol. This works in bash too: printf %u $[~0]. – manatwork – 2017-02-21T14:55:38.913

Aha, nice @manatwork – ʰᵈˑ – 2017-02-21T14:58:07.107

This is architecture-dependent, it doesn't work on i386. – pts – 2017-02-23T13:54:45.570

1@pts Obviously! i386 is 16/32-bits. PHP is very picky about that. For this to work, you need to be in a 64-bit architecture. This is because ~0 is -1, which is 1111111111111111111111111111111111111111111111111111111111111111 in binary, in 64 bits, compared to 11111111111111111111111111111111 in 32-bits, and the numbers are plataform-dependent. – Ismael Miguel – 2017-02-23T14:36:18.923

@ʰᵈˑYou're welcome. I must admit that I slacked a bit. I've copy-pasted 32 1's. If you want, you can fix your grammar a bit on your answer. – Ismael Miguel – 2017-02-23T14:42:23.890

6

JavaScript, 39 38 33 32 bytes

alert(0xafebff0+'737095'+0xc99f)

Edit: Saved 5 bytes thanks to @Arnauld.

Neil

Posted 2017-02-21T11:13:58.210

Reputation: 95 035

2Remove alert as this can be run in a console. – Alexis Tyler – 2017-02-23T14:14:52.313

6

MATLAB / Octave, 22 bytes

eye(['~rw}?='-9 ''])/0

Try it online!

eye is used to create a unit matrix (matrix with 1 on the diagonal, zero otherwise). Without arguments, this creates a 1x1 unit matrix, or in other words, just a 1. It takes an optional argument, which is the data type ('class' in MATLAB terminology) of the created matrix. We thus ask for a 1 of class uint64 , and divide it by zero which results in Inf in MATLAB, which gets clipped at intmax('uint64').

The vector ['~rw}?='-9 ''] evaluates to 'uint64'. Concatenating an empty char to a vector is 1 byte shorter than using char('~rw}?='-9).

Reasoning towards this answer: the built-in intmax sadly evaluates to the maximum of a 32 bit signed integer. The obvious next option is uint64(), which contains the forbidden characters. The alternative is to use a function that takes a string as a data type. Obvious candidates are intmax and cast, but alternatives include zeros, ones and eye.

eye(['~rw}?='-9 ''])/0    % Winning version! 22 bytes.
intmax(['~rw}?='-9 ''])   % Obvious candidate. 23 bytes.
1/zeros(['~rw}?='-9 ''])  % 24 bytes
cast(Inf,['~rw}?='-9 '']) % 25 bytes. Also an obvious candidate, but actually very long.

Note: MATLAB is installed by default on virtually all dodgy gambling sites.

Sanchises

Posted 2017-02-21T11:13:58.210

Reputation: 8 530

6

Java 8, 30 bytes

()->Long.toUnsignedString(~0L)

Test online

Olivier Grégoire

Posted 2017-02-21T11:13:58.210

Reputation: 10 647

Missing java "boilerplate" and system.out.print part – Viktor Mellgren – 2017-02-21T14:08:49.083

2@ViktorMellgren This declares a lambda expression, which is perfectly fine. – Sanchises – 2017-02-21T14:30:07.830

This requires Java 8 – mbomb007 – 2017-02-21T14:43:16.317

20Yes java 8 and up, no more boilerplate! Fear codegolfers! Java is a real contester now. This is the time you all were so scared about, all your codegolfing language are for nothing! Oh wait still 30 bytes,... hides – dwana – 2017-02-21T15:00:05.303

Why not just ()->~0L? The question allowed numeric output – k_g – 2017-02-21T18:44:15.683

@k_g in Java, longs are always signed, they're only treated as unsigned by certain static methods in the Long class. Returning ~0L numerically would be the smallest signed value, not the largest unsigned value (though they have the same representation). – CAD97 – 2017-02-21T20:20:06.287

@mbomb007 Java 8 is the latest supported version. When you mean Java now, it's Java 8 by default. Java 7 isn't supported anymore for wide audience. I'll keep naming my Java answers "Java". – Olivier Grégoire – 2017-02-21T21:07:59.290

I could have written ()->"18446744073709551615" for 26 bytes, but that's the boring answer and no one would have learned of the hidden Java 8's "unsigned" methods. – Olivier Grégoire – 2017-02-21T21:09:37.127

@OlivierGrégoire Same with Python 3, but if someone just puts "Python", it means it works in both 2 and 3. Since we have answers all over the site that use "Java" to mean "Java 7", it's better to include the version. – mbomb007 – 2017-02-21T21:20:33.520

Python 2.7 is still supported, that's a big difference here. – Olivier Grégoire – 2017-02-21T21:55:30.440

5Surely the "shorter solution" uses the illegal characters 1846. – Neil – 2017-02-21T22:40:19.970

Oh... didn't think about those restrictions. Gonna delete it. – Olivier Grégoire – 2017-02-22T01:32:40.863

Long.MAX_VALUE​/0.5 – Magic Octopus Urn – 2017-02-23T19:37:26.380

@carusocomputing the value is then rounded: 1.8446744073709552E19 instead of 18446744073709551615. – Olivier Grégoire – 2017-02-24T01:51:09.037

5

BF, 108 bytes

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

If each command is considered as 3 bits, this is potentially 41 bytes.

Timtech

Posted 2017-02-21T11:13:58.210

Reputation: 12 038

3Each command is one byte. Not 3 bits. – mbomb007 – 2017-02-21T14:45:13.730

Well yes, that's why I put it as 108 bytes... – Timtech – 2017-02-21T15:32:06.680

Yeah, but you said "this is potentially 41 bytes", which it's not. – mbomb007 – 2017-02-21T15:56:04.657

An interpreter could be made to interpret 3-bit groups as one of eight commands +-<>[]., – Timtech – 2017-02-21T15:56:58.387

That already exists. It's called http://esolangs.org/wiki/Binaryfuck

– mbomb007 – 2017-02-21T15:57:49.227

Yes, but, the problem is still that the interpreter takes each value as 1 byte instead of 1 bit. – Timtech – 2017-02-21T15:59:19.420

That's basically what Golunar is for. Sesos is similar. – mbomb007 – 2017-02-21T16:06:29.090

Let us continue this discussion in chat.

– mbomb007 – 2017-02-21T16:09:24.527

5

Retina, 28 27 bytes

Saved 1 byte thanks to Kritixi Lithos


bieegheeahdhajffbgbf
T`l`d

Try it online!

Explanation


bieegheeahdhajffbgbf

Replaces the non-existent/empty input with this string. This particular string was generated by the "inverse" of this program. It encodes a through j as 0 through 9, respectively.

T`l`d

This is a Transliteration stage. The l and d are character sets used for transliteration. l represents the lowercase alphabet, d is all digits. So, it maps abcdefghij back to 0123456789.

Business Cat

Posted 2017-02-21T11:13:58.210

Reputation: 8 927

https://tio.run/nexus/retina#@8/l5Onq6u7h6uro4eLh6OXm5uTu5MYVkuCTkPL/PwA is 1 byte shorter (I used d instead of EO) – user41805 – 2017-02-21T14:32:40.333

@KritixiLithos Oh yeah. I'm still not fully awake :P – Business Cat – 2017-02-21T14:35:26.813

5

Brain-Flak, 64, 62, 58, 54 bytes

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

Try it online!

[Try it online!]

Four bytes saved thanks to @Riley!

Explanation:

#Push a 64
(((((()()()()){}){}){}){})

#While true
{

  #Pop the top of the stack. We'll store this value for later, but first
  ({}

  #Before pushing the value
  <

    #Push (N + 1) * 2 - 1
    # (where N is the number underneath, originally 0)
    (({}()){}[()])

  >

  #And push the TOS minus one back on
  [()])

#endwhile
}

#Pop the zero left over
{}

#And decrement the number underneath
({}[()])

For the record, I tried pushing 32 and quadrupling, but it's the same byte count.

James

Posted 2017-02-21T11:13:58.210

Reputation: 54 537

You can save 4 bytes by using one of the ()s from 64 to push the 1: ((((((())()()()){}){}){}){})

– Riley – 2017-02-21T22:18:28.850

@Riley Aha, of course! Thanks – James – 2017-02-21T22:21:11.700

56 bytes: ((((((())()()()){}){}){}){}[()]){({}<(({}){}())>[()])}{}

– Leaky Nun – 2017-04-30T16:03:16.290

54 bytes:((((((<>)()()()()){}){}){}){}){({}<(({}){}())>[()])}{}

– Leaky Nun – 2017-04-30T16:05:59.820

Um, can't you just do N*2+1 instead of (N+1)*2-1?

– Jo King – 2018-07-23T00:06:20.063

5

C++, 46 bytes.

int m(){std::cout<<unsigned long long(5+3-9);}

First time ever doing a code golf, but I'm fairly happy with myself. Will happily take any critique/suggestions :)

Monkah VII

Posted 2017-02-21T11:13:58.210

Reputation: 191

4

C# 6, 31 bytes

()=>System.Console.Write(~0UL);

Pretty much the same as Java.

C# 5, 56 bytes

class P{static void Main(){System.Console.Write(~0UL);}}

Mr Scapegrace

Posted 2017-02-21T11:13:58.210

Reputation: 221

The C# 6 answer is only an anonymous action, which are also present in C# 5. – TheLethalCoder – 2017-02-21T16:03:29.127

Also the challenge only asks you to output the number so you could compile to a Func<ulong> as: ()=>~0UL; – TheLethalCoder – 2017-02-21T16:05:48.170

It also doesn't say that you can't use any input so you could compile to a Func<int, ulong> to save a byte: _=>~0UL; and I think it would still be valid. – TheLethalCoder – 2017-02-21T16:06:58.033

4

PowerShell, 29 14 bytes

0xC000PB/3-3/3

Try it online!

Thanks to @n0rd for essentially golfing this in half.

This leverages the inbuilt unary PB operator that basically functions as "multiply the preceding number by 1125899906842624" (i.e., how many bytes are in a pebibyte). That's coupled with the hex 0xC000, or 49152, so 49152 pebibytes. We divide that by 3, yielding 18446744073709551616, and subtract 3/3 to get the final value.

AdmBorkBork

Posted 2017-02-21T11:13:58.210

Reputation: 41 581

"0x$(7-3)000PB-9/9"|iex – n0rd – 2017-02-23T06:41:10.903

20xC000PB/3-3/3 – n0rd – 2017-02-23T06:46:06.943

@n0rd Oh, that's dang clever, using PB like that. Thanks! – AdmBorkBork – 2017-02-23T13:24:13.220

@n0rd pretty impressive, welcome to PPCG! – colsw – 2017-02-23T13:37:56.617

4

Forth (gforth), 11 9 7 bytes

true U.

Try it online

true is the same as -1. U. prints a number as an unsigned integer.

This works on TIO, possibly because it has a 64-bit architecture? I'm not sure. If I run -1 U. on repl.it, for example, I get 2**32-1. If repl.it supported double-length integers, outputting them would use UD. instead.

mbomb007

Posted 2017-02-21T11:13:58.210

Reputation: 21 944

You can probably reduce this to -3 3 / U. – zeppelin – 2017-02-21T16:23:34.327

Or, even better: true U. (which also rhythms nicely) – zeppelin – 2017-02-21T16:25:31.547

Oh, I forget about true, because I'm so used to using 0 and 1. Thanks. – mbomb007 – 2017-02-21T16:27:04.613

4

Python3 REPL, 11 bytes

~0^~0>>~077

How it works

  • ~0 is -1 (two's complement, an infinite sequence of '1's)
  • 077 is 63 in octal, so ~077 is -64
  • Shift right with negative parameter is a shift to the left
  • Putting all together, -1 xor (-1 << 64) is the number we are looking for

G B

Posted 2017-02-21T11:13:58.210

Reputation: 11 099

4

JavaScript (ES6), 50 bytes

[...'䠎ᴐIF╏ɧ'].map(s=>s.charCodeAt()).join``

George Reith

Posted 2017-02-21T11:13:58.210

Reputation: 2 424

1You can change the characters to '䠎ᴐIF╏ɧ' and remove the -27 – powelles – 2017-02-22T19:25:40.123

@jdp Nice one, thanks :) – George Reith – 2017-02-23T14:20:21.090

3

Javascript 55 bytes

alert(""+(590300>>5)+(59530-3>>3)+7370955+(3*59*73>>3))

the code generates and then alerts the string 18446744073709551615 using bitwise operations

590300>>5 18446
59530-3>>3 7440
7370955
3*59*73>>3 1615

fəˈnɛtɪk

Posted 2017-02-21T11:13:58.210

Reputation: 4 166

Displays 2588673709551615 for me... – n0rd – 2017-02-23T19:11:08.943

alert(0xafebff0+'7370955'+(3*59*73>>3)) works fine – n0rd – 2017-02-23T19:12:53.590

I am leaving it as it is for the sake of keeping the method used instead of just copying someone else now. – fəˈnɛtɪk – 2017-02-23T19:20:31.173

3

MATL, 8 bytes

l_5Z%EZD

This could probably be improved, but I'm not familiar with strings and types in MATL just yet.

Try it at matl.suever.net

Explanation:

l       % push 1
_       % unary minus
5       % push 5, corresponds to type 'uint64'
Z%      % convert 1 to this type
E       % double
ZD      % display as a string

B. Mehta

Posted 2017-02-21T11:13:58.210

Reputation: 763

It'd need to be YY5Z%ZD to force uint64 type, but I don't know why using 1 5Z% instead just works... – B. Mehta – 2017-02-21T14:12:16.017

You can't use 8. – xnor – 2017-02-21T14:13:20.993

@xnor Oops, fixed. – B. Mehta – 2017-02-21T14:16:09.593

Can you add a demo link using either https://matl.suever.net or http://matl.tryitonline.net?

– Suever – 2017-02-21T21:53:00.243

@Suever Sure, it's there now. – B. Mehta – 2017-02-21T22:30:01.007

@Sanchises It's a Matlab thing: typecast(inf,'uint64') doesn't give 18446744073709551615 either. Not sure why. typecast depends on the internal data representation, so I guess anything can happen – Luis Mendo – 2017-02-23T18:25:35.550

1@LuisMendo Ah, of course - I thought cast was used, but it makes sense if typecast is used. Thanks for clearing that up. – Sanchises – 2017-02-24T10:55:18.523

3

Brain-Flak, 223 193 bytes

Includes +1 for -A
-30 thanks to DJMcMayhem

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

Try it online!

This just pushed the ASCII values of and prints as characters.

For reference, it takes 338 bytes to generate the actual number using the Integer meta golfer.

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

Try it Online!

Riley

Posted 2017-02-21T11:13:58.210

Reputation: 11 345

You could save a bunch if you take advantage of the stack-height nilad []. For example: ((((((((((((((((((((((((()()()){}){}()){}){}())[()()()()])[][]())[[]()()])[]))()()()())[[]()()])[][()])[()()()()])()()()())[(()()()){}()])()()()()))()()())[()])[()()]))()()()())[(()()()){}()]) (Possibly more I'm missing)

– James – 2017-02-21T20:39:52.470

Also, I think you can add one byte for -A since standard invocation already includes -f, so it's only one off to do -fA instead – James – 2017-02-21T20:40:24.027

@DJMcMayhem When did we start using +1 for the arguments? I didn't think about [] I'll look at that when I get a chance. Thanks. – Riley – 2017-02-21T21:04:14.950

3

x64 Assembly, 7 bytes

hex (assembled): 4831C048FFC8C3

disassembled, commented:
XOR RAX,RAX ;Zero the value of 64 bit register RAX DEC RAX ;Decrement the value of RAX RET ;Return this value

RAX is a 64 bit register, and is most often used to return integer arguments (eg, C). By decrementing 1, its value rolls over from 0 to... 2^64-1, which is exactly needed.
Though, the assembled binary contains ones and fours and eights, the assembly doesn't, but the assembled file is counted in assembly, so does it count? Ow, my head.
Also, output is return value in this case.

Orion

Posted 2017-02-21T11:13:58.210

Reputation: 309

2

Jelly, 7 bytes

3’*“@‘’

Try it online!

Ven

Posted 2017-02-21T11:13:58.210

Reputation: 3 382

Why does the TIO link have different code? – Okx – 2017-02-21T11:57:51.927

@Okx Forgot to update the link, fixed :) – Ven – 2017-02-21T11:59:22.220

I think you could do 3’ to get 2. – ETHproductions – 2017-02-21T15:48:04.253

@ETHproductions thanks :P. – Ven – 2017-02-21T15:58:22.497

2

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.

Julian Lachniet

Posted 2017-02-21T11:13:58.210

Reputation: 3 216

2

Swift, 8 bytes

UInt.max

outside playground / repl - 15 bytes

print(UInt.max)

Ashley Mills

Posted 2017-02-21T11:13:58.210

Reputation: 131

2

TI-Basic, 10 bytes

9+7
Ans^Ans-0!

Timtech

Posted 2017-02-21T11:13:58.210

Reputation: 12 038

TI-BASIC can't calculate, store or display this number exactly—floats only have 14 digits (about 44 bits) of precision. – lirtosiast – 2017-04-06T18:38:21.393

2

C#, 20 bytes

()=>ulong.MaxValue;

rick

Posted 2017-02-21T11:13:58.210

Reputation: 121

1This is neither a full program nor a function / lambda and therefore invalid. – corvus_192 – 2017-02-21T21:27:02.860

1Hello, 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 – 2017-02-21T21:34:30.873

2

Ruby, 16 12 bytes

p~0^~0>>~077

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

G B

Posted 2017-02-21T11:13:58.210

Reputation: 11 099

2

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

Kelly Lowder

Posted 2017-02-21T11:13:58.210

Reputation: 3 225

p=E/E and f@f[f@p+f@f@p] – Martin Ender – 2017-02-23T14:44:17.450

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 – 2017-02-23T14:55:13.483

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 – 2017-02-23T19:49:51.950

± 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 – 2017-02-23T21:06:20.383

2

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.

Erik the Outgolfer

Posted 2017-02-21T11:13:58.210

Reputation: 38 134

I'm sure you know what you can golf down now. – Leaky Nun – 2017-04-30T11:20:24.373

@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 – 2017-04-30T13:41:10.283

It's the same as the previous answer from you wherein I commented. – Leaky Nun – 2017-04-30T13:41:40.850

@LeakyNun I found something else too. Golfed. – Erik the Outgolfer – 2017-04-30T13:46:34.143

2

JavaScript, 50 bytes 47 bytes

parseInt(5%3+"7nq9nb9r7b",33+7-9)+btoa("×­y")

Tymek

Posted 2017-02-21T11:13:58.210

Reputation: 121

Why do you append the answer to ''? – Marie – 2018-07-23T12:33:55.050

@Marie it doesn't: https://repl.it/repls/SubstantialNoisyRectangle

– Tymek – 2018-07-23T12:36:09.650

You misunderstood. Why does your code start with ''+? Unless I am missing something, which is possible, you dont need that. – Marie – 2018-07-23T12:51:38.867

ah, ok. I didn't read the requirements right. It can be "either a number, or a single string". Thank you – Tymek – 2018-07-23T12:54:38.000

1Lol, I didnt notice that but my actual point was that btoa returns a string so either way the result should be a string. – Marie – 2018-07-23T12:56:23.353

2

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.

Phlarx

Posted 2017-02-21T11:13:58.210

Reputation: 1 366

This is answer 111111 – dkudriavtsev – 2017-02-24T00:16:24.923

@wat Oooo so it is :) – Phlarx – 2017-02-24T15:45:49.407

2

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.

Leaky Nun

Posted 2017-02-21T11:13:58.210

Reputation: 45 011

2

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.

sundar - Reinstate Monica

Posted 2017-02-21T11:13:58.210

Reputation: 5 296

1

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.

Neil

Posted 2017-02-21T11:13:58.210

Reputation: 95 035

1

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

Mr Scapegrace

Posted 2017-02-21T11:13:58.210

Reputation: 221

Source code can't contain 2. – Michael McGriff – 2017-02-21T15:31:53.917

@MichaelMcGriff fixed. – Mr Scapegrace – 2017-02-21T15:44:46.207

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 – 2017-02-21T22:47:09.577

@ETHproductions yes, thank you. – Mr Scapegrace – 2017-02-22T07:27:14.840

1

Japt, 17 bytes

GpG s r#È*A+PG+Fs

Try it online!

Oliver

Posted 2017-02-21T11:13:58.210

Reputation: 7 160

1

Cardinal 42 bytes

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

Try it Online

fəˈnɛtɪk

Posted 2017-02-21T11:13:58.210

Reputation: 4 166

1

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.

Divcy

Posted 2017-02-21T11:13:58.210

Reputation: 501

Thanks, and i'm sorry for violate the rules. i'm totally new to this site xD – Divcy – 2017-02-23T15:01:29.303

1

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 – 2017-02-23T16:34:01.703

2

@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 – 2017-02-23T21:42:37.410

1

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.

Wilfred Hughes

Posted 2017-02-21T11:13:58.210

Reputation: 111

I think you can remove the space after the comma. – Conor O'Brien – 2017-02-26T04:17:15.897

Oh, beginner mistake! Thanks, updated :) – Wilfred Hughes – 2017-02-26T15:31:54.683

1

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.

Conor O'Brien

Posted 2017-02-21T11:13:58.210

Reputation: 36 228

1

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

PidgeyUsedGust

Posted 2017-02-21T11:13:58.210

Reputation: 631

1

Brain-Flak, 122 bytes

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

Try it online! Also works in Mini-Flak

user68718

Posted 2017-02-21T11:13:58.210

Reputation:

You can shorten this. Instead of 2^2^2, you can use 422 to get 16. (((()()()()){}){}). That's 24 Bytes shorter – Dorian – 2018-07-23T14:52:16.087

1

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!

Giuseppe

Posted 2017-02-21T11:13:58.210

Reputation: 21 077

1

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

Dorian

Posted 2017-02-21T11:13:58.210

Reputation: 1 521

1

JavaScript, 67 52 47 45 39 bytes

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

koko

Posted 2017-02-21T11:13:58.210

Reputation: 201

1

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.

wastl

Posted 2017-02-21T11:13:58.210

Reputation: 3 089

1

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

Dorian

Posted 2017-02-21T11:13:58.210

Reputation: 1 521

1

C (clang), 26 bytes

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

Try it online!

Logern

Posted 2017-02-21T11:13:58.210

Reputation: 845

0

Python, 19 bytes

In REPL

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

Not in REPL

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

Daniel

Posted 2017-02-21T11:13:58.210

Reputation: 6 425

0

Pyke, 5 bytes

Zw`@t

Try it here!

 w`   -   64
Z  @  -  set_bit(0, ^)
    t - ^ -1

Blue

Posted 2017-02-21T11:13:58.210

Reputation: 26 661

0

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.

James

Posted 2017-02-21T11:13:58.210

Reputation: 54 537

0

Ruby, 18 bytes

p (9+7)**(9+7)-7/7

dkudriavtsev

Posted 2017-02-21T11:13:58.210

Reputation: 5 781

Would (9+7)**(9+7) save you a byte? – Neil – 2017-02-21T22:49:12.543

0

MUMPS, 15 bytes

w 9+7**(9+7)-'0

psr

Posted 2017-02-21T11:13:58.210

Reputation: 121

0

SmallTalk – 60 characters

Transcript show:(((7+9)raisedTo:(7+9))-(3/3))printString;cr.

user15259

Posted 2017-02-21T11:13:58.210

Reputation:

0

SmileBASIC, 35 bytes

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

x should be replaced with CHR$(1615)

12Me21

Posted 2017-02-21T11:13:58.210

Reputation: 6 110

0

Groovy, 28 Bytes

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

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

Magic Octopus Urn

Posted 2017-02-21T11:13:58.210

Reputation: 19 422

0

GO 62 bytes

package main
import ("fmt")
func main(){fmt.Print(^uint64(0))}

(This is my first submit too)

Brad McCormack

Posted 2017-02-21T11:13:58.210

Reputation: 1

3Your source code contains '6' and '4' I'm afraid. – Wilfred Hughes – 2017-02-25T15:28:37.470

I'm blind. Thanks for that. – Brad McCormack – 2017-03-01T03:06:58.193

0

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.

Robert Benson

Posted 2017-02-21T11:13:58.210

Reputation: 1 339

0

Java, 92 Bytes :-D

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

Dorian

Posted 2017-02-21T11:13:58.210

Reputation: 1 521

-1

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.

iwaseatenbyagrue

Posted 2017-02-21T11:13:58.210

Reputation: 231

1This is a snippet, every submission needs to be a full program or function. – Business Cat – 2017-02-27T14:19:43.730