# Conway's Monster

This challenge is in honor of mathematician John Conway who passed away April 11, 2020 due to COVID-19. He was famous for coming up with the Game of Life cellular automaton and many other mathematical contributions such as the surreal numbers and the monster group.

The advanced math of those topics is out scope for this programming challenge, though I strongly recommend people watch the various Numberphile videos about Conway. In one of those videos Conway says that he'd like to know why the monster group exists before he dies. It's unfortunately too late for that now but we can honor his memory in a very small way by exploring in code the strange number associated with the group.

# Challenge

The monster group is the largest sporadic simple group in the branch of group theory in mathematics. But the only thing to know for this challenge is that its order, or number of elements it contains is:

808017424794512875886459904961710757005754368000000000


Your task is to write a program that outputs this number. However, to keep this from being trivial, your program may not contain any digits, 0 through 9. That is, your program may not contain any of the ten characters 0123456789.

Your output must be the precise digits of the number:

808017424794512875886459904961710757005754368000000000


or the digits with appropriate commas:

808,017,424,794,512,875,886,459,904,961,710,757,005,754,368,000,000,000


(Commas , are allowed in your code.)

Any usual output method is valid. No input should be required. The shortest program in bytes wins.

If it helps anyone the factorization of the number is:

2^46 * 3^20 * 5^9 * 7^6 * 11^2 * 13^3 * 17 * 19 * 23 * 29 * 31 * 41 * 47 * 59 * 71


(Factorization is not valid output.)

• Are non-Ascii digits like ⁴ acceptable? Apr 14, 2020 at 23:47
• @JonathanAllan Certainly. Apr 15, 2020 at 0:13
• How is this not a duplicate of the 2014 version of this challenge? The only difference what number is being output. Apr 15, 2020 at 0:27
• I don't consider this a duplicate at all, just another challenge in the same genre. Different target numbers are quite different--ranging from easy targets (like 2014) to theoretically difficult ones (such as incompressible numbers in the sense of Chaitin). Interesting ones would usually be between these two extremes, like this monster challenge. They're like any code-golf puzzle--you need to find hidden patterns in the target that you can exploit. But different numbers have different patterns! (That this challenge can be interesting is borne out by the variety of solutions already posted.) Apr 15, 2020 at 3:25
• I feel obligated to link to the real codegolf monster related to John Conway: tetris made in Game of life: codegolf.stackexchange.com/questions/11880 Apr 15, 2020 at 10:28

# Sledgehammer, 4 bytes

31 bits, to be overly specific

⣶⣖⡥⣕


(this is a very awesome Mathematica compressor, and it really excels at compressing code with only a few powerful built-ins)

In this case, the built-ins are GroupOrder and MonsterGroupM, because of course they exist.

In case this somehow helps, the exact bits contained in the code are 01110111 01110101 10110010 1011010, the corresponding Mathematica code is GroupOrder@MonsterGroupM[], and the internal suffix code is call["MonsterGroupM", 0], call["GroupOrder", 1], where 0 and 1 are the argument counts.

# Jelly, 21 bytes

⁴Ḥ®x“ÆÑ¥©µ"µ£€× œ‘;Æ¡


Try it online!

### How?

$$|M|=13\times 43!+16\times 42!+4\times 41!+6\times 40!+9\times 39!+34\times 38!+9\times 37!+2\times 36!+12\times 35!+17\times 34!+32\times 33!+30\times 32!$$

So...

⁴Ḥ®x“ÆÑ¥©µ"µ£€× œ‘;Æ¡ - Main Link: no arguments
⁴                     - literal 16
Ḥ                    - double = 32
®                   - recall from register = 0
x                  - times = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
“ÆÑ¥©µ"µ£€× œ‘    - list of code-page indices = [13,16,4,6,9,34,9,2,12,17,32,30]
;   - concatenate = [13,16,4,6,9,34,9,2,12,17,32,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Æ¡ - convert from factorial base to integer


For what it's worth a naive base-250 compression is 25 bytes AND contains digits: “Æ4Ḍ⁹|oGO⁷pNJ6þḤ)Ė⁽u2ẏẏż’

• Nice! I didn't know that factorial representation of the number Apr 15, 2020 at 0:01
• Neither did I, but I don't think it's all that unexpected for it to have a fairly nice representation in the factorial number system. Apr 15, 2020 at 0:05
• Darn, this was the method I was going to use - iterated and descending factorials. Absolutely well done, mate. Very crisp solution! Apr 15, 2020 at 10:37
• @Mathgeek go for it - unless your solution was also going to be in Jelly and would be longer I see no reason not to use the same idea! Apr 15, 2020 at 18:40

# Python 2, 61 bytes

-5 bytes thanks to @Surclose Sputum!

for i in"  @@G^dddrstuuuvwxxy{|~~~~~":True*=ord(i)
print True


Try it online!

# Python 3, 60 58 bytes

Thanks to @Surculose Sputum for saving 2 more bytes!

k=True
for i in b"?G^dddrstuuuvwxxy{|~~~~":k*=i+i
print(k)


Try it online!

• 61 bytes Apr 14, 2020 at 22:32
• 60 bytes with a bytestring in Python 3.
– ovs
Apr 15, 2020 at 6:29
• @ovs Thanks, funnily enough I tried to use a b-string in Python 2. I guess I forgot that it only works in Python 3. Apr 15, 2020 at 6:37
• 58 bytes in Python 3 by doubling each character before multiplying together. Apr 17, 2020 at 7:07
• @SurculoseSputum Indeed, it saves me 3 bytes in my answer too!
– Neil
May 8, 2020 at 12:35

# Charcoal, 32 29 bytes

ＩΠＥ/Gdddrstuuuvwxxy{|~~~~~⊗℅ι


Try it online! Explanation: Converts the characters to their ASCII character codes, doubles them, then takes the product. Edit: Saved 3 bytes by porting @SurculoseSputum's golf of @dingledooper's Python 3 answer.

However, Charcoal can just compress the output text... except that compression of the whole text includes an 8, so you have to print it in two parts:

”)¶″³L⬤j$a◧EτB⊟[βω⁵↓≧Ｏ””|～ⅉE  (Compressing the string in the first program doesn't help as the resulting string contains a digit.) Try it online! Link is to verbose version of code. • I still see a "6" there. – Almo Apr 15, 2020 at 19:12 • @Almo Thanks; I discovered that I'd also pasted the wrong link anyway. The new one is a byte longer sadly. – Neil Apr 15, 2020 at 20:13 # Wolfram Language (Mathematica), 34 32 bytes Thanks @my pronoun is monicareinstate for shaving 2 bytes! Someone has to do this... Print@GroupOrder@MonsterGroupM[]  Try it online! • 32 bytes by @ instead of // and []: Try it online! Apr 15, 2020 at 11:45 • Alright, thanks! @mypronounismonicareinstate Apr 15, 2020 at 11:46 • You can save a few bytes by writing GroupOrder@MonsterGroupM[]&. This is a function (which on here is equivalent to a program by default) that outputs the correct number regardless of the input. Apr 17, 2020 at 16:59 • Even shorter would be GroupOrder@*MonsterGroupM, which is the same as Greg Martin's function when called with no arguments Apr 24, 2020 at 15:30 # Ruby, 67 bytes "nn/HM|Q:iv^YxO[e}%W}}WTBn}}}}}}}}".bytes{|i|$><<(i+?A.ord)%?_.ord}


Try it online!

By coincidence, the range of digit pairs is 0 to 94, which only just fits in the ASCII range.

(i+?A.ord)%?_.ord = (i+65)%95. The 65 offset ensures no digit characters in the magic string.

By default numbers are printed without leading zeros, so digit pairs in the range 00..09 require two characters in the magic string. The other digit pairs require one character.

# Java 8, 86 bytes

v->"ᾑ䐑Ἂ㉌⊡▒д᭞ᵸ᪑".chars().forEach(c->System.out.print(~-c))


Try it online.

Explanation:

v->  // Method with empty unused parameter and no return-type
"ᾑ䐑Ἂ㉌⊡▒д᭞ᵸ᪑".chars().forEach(c->
//  Loop over the characters of this string as integer codepoints:
System.out.print(~-c))
//   Print this integer - 1 to STDOUT


The string contains the characters with the codepoints:

8081,17425,7946,12876,8865,59905,9618,1076,7006,7544,6801,1,1,1,1,1,1,1


# MATL, 35 bytes

'nTIFBCAAAAA@A@A@A@@A'tfYqwIEW-^X$p  Try it online! ### Explanation This uses the prime factorization of the number: $$\ 808017424794512875886459904961710757005754368000000000 \\ = 2^{46} · 3^{20} · 5^9 · 7^6 · 11^2 · 13^3 · 17 · 19 · 23 · 29 · 31 · 41 · 47 · 59 · 71. \$$ 'nTIFBCAAAAA@A@A@A@@A' % Push this string t % Duplicate f % Indices of nonzero chars: gives [1 2 3 ... 19 20] Yq % n-th prime, element-wise: gives [2 3 5 ... 67 71] w % Swap IEW % Push 3, multiply by 2, exponential with base 2: gives 64 - % Subtract, element-wise: subtracts 64 from the code point % of each character of the string. Gives [46 20 9 ... 0 1] ^ % Element-wise power. Gives [2^46 3^20 5^9 ... 1 71] X$                     % Convert to symbolic (to achieve arbitrary precision)
p                      % Product. Implicit display


# Jelly, 37 30 bytes

ØẠiⱮ“tTIFBC”;⁽<(B¤
³ÆRṁ¢ż¢*/€P


Encodes the number as a list of exponents to primes, probably could be optimized with cleverer builtins

ØẠiⱮ“tTIFBC”;⁽<(B¤
“tTIFBC”       the string "tTIFBC"
iⱮ               find indices of each character in
ØẠ                 the alphabet in both cases "A..Za..z"
⁽<( ¤ the number 16041
B¤ converted to binary
;      append

³ÆRṁ¢ż¢*/€P
ÆR         all primes below
³           100
ṁ        shaped like
¢       the above line
ż      zipped with
¢     the above line
*/€  exponent for each pair
P product


-7 bytes by encoding the final 0/1 sequence as binary

Try it online!

# 05AB1E, 2928 27 bytes

-1 byte thanks to @KevinCruijssen

•∍ýö/V$Éb´‰ŒrƶÜλFÄôS•¦¾T<×«  Try it online! # 05AB1E, 21 bytes Answer suggested by @KevinCruijssen as a port of the Jelly answer by @JonathanAllen ₆ÍRžwŸ!•Pǝ½ζÄž,Ā•₆в*O  Try it online! # Haskell, 91 bytes import Data.Numbers.Primes product[p^length[';'..c]|(c,p)<-zip"hNC@<=;;;;;:;:;:;::;"primes]  Try it online! (has an extra 2 bytes for x=) Probably suboptimal but I had a lot of fun writing it. I encode the prime exponents (including zeroes for the primes it doesn't have prior to 71) as a string using the character's relative distance from :. the rest is a simple matter of zipping the exponents against an infinite list of all primes, raising those primes to that power, and taking the product. Edit: forgot to take the x= out of the source code on here. • almost... idk why product is returning a negative number tbh May 8, 2020 at 11:01 • @ASCII-only it's because length always returns an Int and this number is too big to be stored as an Int so it overflowed into the negatives. In my code I made sure the type of x was ambiguous so that GHC would default it to Integer which is arbitrary precision. May 9, 2020 at 15:20 # C (gcc), 84 $$\\cdots\$$ 81 83 bytes Saved a byte thanks to ceilingcat!!! Added 2 bytes to fix a bug kindly pointed out by gastropner. *s;f(){for(s=L"nn/HM|Q:iv^YxO[e}%W}}WTBn}}}}}}}}";*s;)printf("%d",(*s+++'A')%'_');}  Try it online! Port of Level River St's Ruby answer. • Oh wait... We got a problem here. 02 :( Apr 15, 2020 at 11:20 • @newbie Yikes! Just saw that too! T_T Apr 15, 2020 at 11:20 • Sorry, the direct approach is smaller. That %'_' doesn't actually save anything. Jul 30, 2020 at 22:38 • Think you need to sacrifice two bytes to change those numbers into chars to avoid digits. Aug 21, 2020 at 21:24 • @gastropner Oops, miss that. Now fixed. Well spotted - thanks! :-) Aug 21, 2020 at 22:09 # Vyxal, 27 25 bytes Thanks to Underslash for -2 bytes because numbers. »$⇩∪£¼ɾǏ℅yṙ₆gǏ¦¨λ»kεk×**


Try it Online!

Unfortunately, the compressed form of the number contains a 2 and a 0. This is a different number, multiplied by another number multiplied by another number, to get the target number.

»$⇩∪£¼ɾǏ℅yṙ₆gǏ¦¨λ» # Push 11482618231106483731969943632999939453125 kε # Push 32768 k× # 2147483648 ** # Multiply all the numbers # Implicit output  • 25 bytes by dividing the number by 2^31 and 2^15, compressing that, and then multiplying to get the correct output. May 19, 2021 at 22:59 # Wolfram Language (Mathematica), 93 bytes FromDigits[LetterNumber/@Characters@"h h agdbdgideabhgehhfdeii difaga geg egedcfh "]  Try it online! • GroupOrder[MonsterGroupM[]] saves 66 bytes. Apr 15, 2020 at 15:09 • @MeesdeVries of course there is a mathematica built in... it is already posted in another answer Apr 15, 2020 at 15:32 • Oops, I didn't even read all the answers before commenting. My bad. :-) Apr 16, 2020 at 7:53 # Bash + Core utilities, 67 bytes tr o-z /-:<<<xpxpqwtrtwytuqrxwuxxvtuyyptyvqwqpwuwppuwutsvxppppppppp  Try it online! # Octave, 50 bytes prod(primes('G').^sym('hNC@<=;;;;;:;:;:;::;'-':'))  Try it online! • This deserves more votes! I'm impressed! – CG. Aug 21, 2020 at 8:23 # C++ (gcc), 82, 76 bytes ### Kudos to @ceilingcat for -6 bytes void f(){for(auto s:L"󅑑񧭚񽍫󘚻󜼁𑖣򫂟ƴ󃔀")printf("%i",s);printf("%i%i%i",!f,!f,!f);};  Try it online! # C++ (gcc), 82 bytes void f(){for(auto s:L"󅑑񧭚񽍫󘚻󜼁𑖣򫂟ƴ󃔀")printf("%i",s);printf("%i%i%i",NULL,NULL,NULL);};  Try it online! My first ever Code Golf submission! :) Explanation: The loop part of the function prints a decimal representation for each Unicode character in the string. I was really stumped as to how to print zeros without being allowed to have 0 in the code. I just added NULL characters cast to int. • Also, welcome to CGCC! Apr 18, 2020 at 3:04 • @ceilingcat - Thanks for the welcome and the tips. Of course! A boolean of a function name always exists. That's clever. Apr 18, 2020 at 4:04 • -3 bytes by replacing auto and void with int, and removing the semi-colon at the end. Apr 18, 2020 at 5:52 • @StealingMana You can't keep #include<cstdio> out of your code as it's needed for your function to work. In other words it has to be it part of your byte count. Aug 22, 2020 at 20:06 • Suggest int instead of auto Sep 11, 2020 at 8:27 # JavaScript (Node.js), 79 78 58 bytes Saved 20 (!) bytes thanks to @tsh A port of Neil's approach. _=>eval(Buffer("?@^ddrtuuuvwxxy{|~~~~Ȁ掀").joinn*+'n')  Try it online! # JavaScript (Node.js), 93 bytes _=>eval('ZxEDCCCCBAECEBBBBn*ZxEAAFEEEFECn*ZxFFCn*ZxFDDAAEn*ZxAZZZZZZZZZZn'.replace(/Z/g,+[]))  Try it online! The idea here was to look for factorizations of $$\N\$$ with factors whose hexadecimal representation only contains letters and $$\0\$$'s, so that we only need to replace $$\0\$$'s with a substitute character. There are countless possibilities. We use this one: 0xEDCCCCBAECEBBBB * 0xEAAFEEEFEC * 0xFFC * 0xFDDAAE * 0xA0000000000  # JavaScript (Node.js), 101 bytes _=>eval("FxHOOFdNebfLLMHOGdFMcFGKKffKn*In**HFn<<JLn".replace(/[A-Z]/g,c=>c.charCodeAt()%(~[]+[+[]])))  Try it online! The encoded expression is: 0x2990d8ebf667291d07c0155ff5n*3n**20n<<46n  • – tsh Apr 15, 2020 at 8:50 • Use " ^ddrtuuuvwxxy{|~~~~~Ȁ掀" may save 1 byte – tsh Apr 15, 2020 at 9:12 • are we allowed to end the output by a "n" like this? Apr 15, 2020 at 10:22 • @Kaddath It is notation for BigInt type. If you try to convert the result to String, the n will disappear. For example, you may print the result to a file by fs.writeFileSync('1.txt', f()). And you won't get n in the file. – tsh Apr 16, 2020 at 1:58 • @tsh Thanks, it's a great answer of course, however, if I would be picky, the challenge being "Your output must be the precise digits of the number", the output is not exactly right and the code would be only missing +'' at the end.. Apr 16, 2020 at 10:44 # Java (JDK), 81 bytes v->"XPXPQWTRTWYTUQRXWUXXVTUYYPTYVQWQPWUWPPUWUTSVXPPPPPPPPP".chars().map(n->n-' ')  Try it online! If Java's int allowed for (much) more than 32 bits, the following (65 bytes) would have worked: v->",--------<?DGLRT\\^hhhpppptv|".chars().reduce(',',(a,b)->a*b)  # K4, 64 bytes, Solution: ,/$.Q.a?"iaiabhecehjefbcihfiigefjjaejgbhbahfhaafhfedgiaaaaaaaaa"


Explanation:

Really boring, lookup each letter in the alphabet (e.g. "b" => 1), convert to string and flatten

    ,/$.Q.a?"iaiabhecehjefbcihfiigefjjaejgbhbahfhaafhfedgiaaaaaaaaa" / solution "iaiabhecehjefbcihfiigefjjaejgbhbahfhaafhfedgiaaaaaaaaa" / a -> 0, b -> 1 etc .Q.a? / lookup in built-in alphabet a-z$                                                              / convert to string
,/                                                               / flatten


# Perl 6, 42 bytes

say [*] ²X*'}}}~~~~~yuuuwr\t|{^;G'.ords


Try it online!

Uses the same strategy of reducing the ordinal values of a string by multiplication as other answers, but also multiplies each element by 2 beforehand to save a byte on representing all those powers of two.

# brainfuck, 183171 170 bytes

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


Try it online!

# Ruby, 50 47 bytes

p eval (%w(Gv/ R>t. &DhP)*" @QQH}bMA").bytes*?*


Try it online!

Thanks histocrat for -1 byte, ad Jo King for pointing out some silliness in the original answer.

# Canvas, 25 bytes

“&ｘｏ+Ｍ0Fi&W（d╷↓¹]│⁸Y↑ŗ³－„


Try it here!

So I thought, "What if I just lazily did number compression in Canvas?" and this was the result. Somehow it worked.

# Io, 79 bytes

"ᾑ䐑Ἂ㉌⊡▒д᭞ᵸ᪑"foreach(i,(-i)bitwiseComplement print)


Try it online!

# Red, 88 78 bytes

foreach c"XPXPQWTRTWYTUQRXWUXXVTUYYPTYVQWQPWUWPPUWUTSVXPPPPPPPPP"[prin c - sp]


Try it online!

# Pyth, 41 bytes

*F^MC,fP_TSC\G+C\.xLG"ujgcdbbbbbabababaab


Try it online!

*F^MC,fP_TSC\G+C\.xLG"ujgcdbbbbbabababaab    Implicit: G=lower case alphabet

L "ujgcdbbbbbabababaab    For each character in the string...
x G                        ... find it's index in the alphabet
+C\.                           Prepend 46 (character code of .) - these are the prime powers
C\G                               71
S                                  Range 1-71
fP_T                                   Filter keep the primes in the above
,                                       Pair the primes with the prime powers
C                                        Transpose
^M                                         Map exponent operator over each pair
*F                                           Take product of the result, implicit print


iiisdo{d}oiiisdo{d}oioisiiiodddoddosoiiioiiodddddoioddddoioisdododdoiiiooddoddoioddsoo{d}oiisodsodddo{d}ioisiiio{d}iodoiisiiioddoiio{d}ooiisioiioddododoiiioii{o{d}}


Try it online!

## C (gcc), 77 bytes

*s;f(){for(s=L"pp!'JO~S<kx[zQ]g kf YVDp        ";*s;)printf("%d",*s++-' ');}


Assumes that wchar_t and int have the same size. This way we can make the string wide and we can omit the type when declaring s.

A naive approach: group the digits in blocks of 1–3, each of which is an integer between 0 and 127 with no leading 0. Since character 0 can't be present in the string, characters are encoded as their value plus some constant. The constant is 32, which has the advantage of keeping all characters printable.

### C (gcc), 78 bytes

Bonus: without relying on wchar_t and int having the same size. We save 1 byte (the L) by not having a wide string, but lose 1 byte because the implicit-int declaration *s is replaced by the explicit type name char.

f(){for(char*s="pp!'JO~S<kx[zQ]g kf YVDp        ";*s;)printf("%d",*s++-' ');}


Try it online!

# ><>, 36 bytes

|.ab*n!?+il"ØØØØØØÕìëöøèúúæò÷õîÐÐÄp"

Try it online!

It's based on a hand-optimized list of partial products of the prime factors of the number, each fitting within a byte.