| Bytes | Lang | Time | Link |
|---|---|---|---|
| 106 | Wolfram Language Mathematica | 210207T214722Z | att |
| 030 | Jelly | 210208T011956Z | Jonathan |
| 037 | Vyxal | 240403T203436Z | emanresu |
| 325 | PowerShell | 210211T125953Z | Zaelin G |
| 139 | Haskell | 210407T204319Z | Delfad0r |
| 5368 | Deadfish~ | 210224T083737Z | emanresu |
| 301 | C# Visual C# Interactive Compiler | 210207T210417Z | Gymhgy |
| 094 | Pyth | 210208T034819Z | hakr14 |
| 147 | bc 1.07 | 210212T161948Z | ovs |
| 349 | Python 3 | 210212T093243Z | Wasif |
| 174 | Python 3.7 | 210208T011429Z | weatherm |
| 129 | Julia 0.4 | 210208T171731Z | MarcMush |
| 151 | Python 2 | 210207T213522Z | dingledo |
| nan | This first attempt is mildly golfed | 210208T180243Z | Digital |
| 053 | Husk | 210208T214636Z | Dominic |
| 040 | 05AB1E | 210208T191036Z | Makonede |
| 606 | Bubblegum | 210208T175628Z | Digital |
| 188 | Python 3.8 | 210207T220054Z | Noodle9 |
| 036 | 05AB1E | 210207T224747Z | ovs |
| 149 | JavaScript Node.js | 210207T210524Z | Arnauld |
| 083 | J | 210207T212508Z | Jonah |
| 064 | Charcoal | 210207T212607Z | Neil |
| 039 | Jelly | 210207T211122Z | caird co |
| 033 | Jelly | 210207T212158Z | ais523 |
| 1370 | Python 2 | 210207T193641Z | Seth |
Wolfram Language (Mathematica), 110 108 107 106 bytes
k=1
d=Set@k##&@@+Prime@Accumulate[+k#+1]^k^#&@*IntegerDigits
Print@d@d@36^^16yk3y2kcq6hc87t5gstghaesn1uqnv
Starts from the result of step 2, 16yk3y2kcq6hc87t5gstghaesn1uqnv in base 36.
d performs both steps 3 and 4, depending on the value of k:
d= ##&@@+ product of:
Set@k (initialize for step 4)
(step 3: k is 1)
Prime@Accumulate[1#+1]^1^# primes, skipping over n at a time,
(step 4: k is Sequence[])
Prime@Accumulate[0#+1]^# successive primes to the power of n
&@*IntegerDigits for each digit n
Jelly, 32 30 bytes
“Œɱl»O_96×⁵Ėḅȷ+12ȷÆnPD‘ÄÆNPDÆẸ
How?
“Œɱl»O_96×⁵Ėḅȷ+12ȷÆnPD‘ÄÆNPDÆẸ - Link: no arguments
“Œɱl» - dictionary word "unsharpened"
O - ordinals [117,110,115,104,97,114,112,101,110,101,100]
_96 - minus 96 [21,14,19,8,1,18,16,5,14,5,4]
×⁵ - times ten [210,140,190,80,10,180,160,50,140,50,40]
Ė - enumerate [[1,210],[2,140],[3,190],[4,80],[5,10],[6,180],[7,160],[8,50],[9,140],[10,50],[11,40]]
ḅȷ - from base 1000 [1210,2140,3190,4080,5010,6180,7160,8050,9140,10050,11040]
+12ȷ - add 12000 [13210,14140,15190,16080,17010,18180,19160,20050,21140,22050,23040]
Æn - next prime above [13217,14143,15193,16087,17011,18181,19163,20051,21143,22051,23041]
P - product 58322536285290033985886806240808836417438318459
D - digits [5,8,3,2,2,5,3,6,2,8,5,2,9,0,0,3,3,9,8,5,8,8,6,8,0,6,2,4,0,8,0,8,8,3,6,4,1,7,4,3,8,3,1,8,4,5,9]
‘ - increment [6,9,4,3,3,6,4,7,3,9,6,3,10,1,1,4,4,10,9,6,9,9,7,9,1,7,3,5,1,9,1,9,9,4,7,5,2,8,5,4,9,4,2,9,5,6,10]
Ä - cumulative sums [6,15,19,22,25,31,35,42,45,54,60,63,73,74,75,79,83,93,102,108,117,126,133,142,143,150,153,158,159,168,169,178,187,191,198,203,205,213,218,222,231,235,237,246,251,257,267]
ÆN - nth prime [13,47,67,79,97,127,149,181,197,251,281,307,367,373,379,401,431,487,557,593,643,701,751,821,823,863,883,929,937,997,1009,1061,1117,1153,1213,1237,1259,1303,1361,1399,1453,1483,1489,1559,1597,1621,1709]
P - product 142994592871080776665367377010330975609342911590947493672510923980226345650368095529497306323265234451588273628492018413579702589
D - digits [1,4,2,9,9,4,5,9,2,8,7,1,0,8,0,7,7,6,6,6,5,3,6,7,3,7,7,0,1,0,3,3,0,9,7,5,6,0,9,3,4,2,9,1,1,5,9,0,9,4,7,4,9,3,6,7,2,5,1,0,9,2,3,9,8,0,2,2,6,3,4,5,6,5,0,3,6,8,0,9,5,5,2,9,4,9,7,3,0,6,3,2,3,2,6,5,2,3,4,4,5,1,5,8,8,2,7,3,6,2,8,4,9,2,0,1,8,4,1,3,5,7,9,7,0,2,5,8,9]
ÆẸ - prime exponentiate (answer)
Vyxal, 37 bytes
»°øḊ⟩√ɾ§»₄τ₀ʀ13+₁*+₀*∆ṖΠf›¦‹ǎΠf:ẏǎ$eΠ
Try it Online! Directly implements the algorithm.
»°øḊ⟩√ɾ§» # Base-255 compressed integer
₄τ # Decoded from base-26 into [21, 14, 19, 8, 1, 18, 16, 5, 14, 5, 4]
₀ʀ # [0...10]
13+ # [13...23]
₁* # [1300, 1400...2300]
+ # Added to above charcodes
₀* # Each multiplied by 10
∆Ṗ # Next prime after each
Π # Take product
f›¦‹ # Flatten and take cumulative sum
ǎΠ # Nth prime for each, take product
f # Take as a list of decimal digits
:ẏǎ # Generate the corresponding list of primes
$e # Each taken to the power of the corresponding digit
Π # Take their product
PowerShell, 345 325 bytes
-20 bytes thanks to mazzy!!
This is a bit of a silly answer just for the fun of it. It could probably definitely be golfed further, but I got tired of fiddling with the numbers. This is derived from the prime factorization of the 1264-digit number. Effectively, I factorized the number, then broke the factors into groups based on how many times they occur in the factorization, then multiplied those groups into the largest numbers PowerShell will parse to cut down on '*' characters. Not terribly exciting, but I was curious how far this method would cut the number down.
"$(echo 19805596543926073442 78873566720902235*18013318998359734663 593140350139852859*8104731785668783073 6644372255178073982360301 1353238597766773*12805823735079030233 6662348615646027385791148837 13372864637471*7423896006336743 14127919992957378413027 74874566303993533*2096862721178836784989|%{"[bigint]$_*"*++$i})1"|iex
Haskell, 139 bytes
t.zipWith(^)p.f.f$fromEnum<$>"آ\\maXyZ]k^d"
f=map(read.pure).show.t.map(p!!).scanl1((+).(+1))
p=[x|x<-[2..],mod(-t[1..x-1])x==1]
t=product
Try it online! (the code above times out on TIO, so the link points to a slightly more efficient version).
How?
♣ Preliminaries
t=product defines an alias for product (the builtin name is so long that even using it twice saves bytes). p=[x|x<-[2..],mod(-t[1..x-1])x==1] is the list of all prime numbers, courtesy of xnor's well known trick based on Wilson's theorem.
♣ Steps 1-2
f$fromEnum<$>"آ\\maXyZ]k^d"
f=map(read.pure).show.t.map(p!!).scanl1((+).(+1))
We start from the unicode string "آ\\maXyZ]k^d" (actually all the characters but the first are printable ASCII characters), and we extract their code points in a list of integers thanks to (fromEnum<$>). The result is the following list.
[1570,92,109,97,88,121,90,93,107,94,100]
What's special about this list? Let's see what happens when we pass it to the function f.
scanl1((+).(+1))\$\implies\$[1570,1663,1773,1871,1960,2082,2173,2267,2375,2470,2571]. Nope, still very mysterious.map(p!!)\$\implies\$[13217,14143,15193,16087,17011,18181,19163,20051,21143,22051,23041]. Ah-ah! Indexing into the list of primes yields exactly the prime numbers described in step 2.t\$\implies\$58322536285290033985886806240808836417438318459. We take the product.map(read.pure).show\$\implies\$[5,8,3,2,...,8,4,5,9]. Finally, we get a list of the individual digits.
This is definitely not the shortest way of obtaining this list. For instance, simply encoding the product in hexadecimal and then extracting the digits would require fewer bytes. However, having already defined the function f, performing step 3 is trivial.
♣ Step 3
f
Don't believe it? Let's try applying f once more, this time starting from [5,8,3,2,...,8,4,5,9].
scanl1((+).(+1))\$\implies\$[5,14,18,21,...,245,250,256,266]. As described in the problem statement, we count up from0, skipping5numbers, then8numbers, and so on. This list is different from the one described in the statement (each number is decremented by one) since our list of primes is 0-indexed.map(p!!)\$\implies\$[13,47,67,79,...,1559,1597,1621,1709]. We index into the list of primes.map(read.pure).show.t\$\implies\$[1,4,2,9,...,2,5,8,9]. Just as before, we compute the product and we split it into individual digits.
♣ Step 4
t.zipWith(^)p
Step 4 is relatively boring. We raise each prime to the corresponding digit (zipWith(^)p) and we take the product (t).
♣ Output
As expected, the output is
10346063175382775954983214965288942351853612536382034663905935101461222060548195774084941504127779027795484711048746289269095513027910438498906751225648197766590064457965461314130149942152545074712074006545797623075756579902190433531325851645586375231773037880535184421903026638874897489950008250798014478066014893203193926076357920163707042852616942733354325378261468425502224936203089956427521668102778596882443702230532724374828028933960643144327285227754985461570358500265135333500954075465441985256254776102064625494398779453723330206306859677410408807692326906168737018862161148707729611012076342295413323680430446529763872458887191437347994063250920466184003173586602441075384748222102267773145003624260992372156354624662289026123081819214885321984526331716887191378907363723962768881646531494039722207338471537744184950666337656928147552391544567298663655079621129011773598162469141317639170063853667739680653118979048627652462235681893246541359880812508588104345141359691398313598202577424145658860334913269759048622492214169304247816441675958725602279911468750380291607080058491441201347157459047314438815796116358356171983789000270540329047696182295315977628397256525031861796294929740163865774776146472541890007191451515587790900275580657982495983198842069735835409348390389014043245596652434869311982404102985853034513631928339140603461069829946906350
Deadfish~, 5368 bytes
{{i}ddddd}dcdciiiciciicddddddciiiiiicdddcddciiiiiicddcddciiiiicddddddciiiiiccddciiiicddddcdciiiiicdcdddddcdcdciiiciiiiicdddcdcdddciiiiiiccicdddddcddciciicddddc{i}dddcdddcddciiicdddddciciiicddciiicdddciiiiicddddddcddciiiciciiccdddciiiiiic{d}iciiiiiciiiicddddddciicddddcdciciiiciicdddddcicccddciiiiiicddddddciiiiicdciiiic{d}iiic{i}ddcddddciiccdddcddddc{i}ddcddddciiiiicdddddcdddciiiicdddddciiiicdddciciiiiiccciic{d}iciiciiiiicciicddddcdciiiicddddciiicddddddccdciiiiciiiicdcdddciicddddciiiiiicic{d}iiiciiiiciiic{d}ic{i}dcddddccddddciicdddciiciiiiiciic{d}iicdciiiicdciiiiicddddciiiiicdcic{d}iciiiiiicicddcddddcicciiicicddciiiic{d}iiic{i}ddcddccdccdciiiic{d}icciiiiiicddcciciiciicdddcdcdciicdddddciicddciiicdddciicdddciciiiciiiiiccdddddcddcdciiiicdddciiicdcicdddddc{i}dddcdddciiicddddddcicddc{i}dddcdddcddddcciiiiiicdcdciciiciicddcdcddddcicdddc{i}dddcddciicddcicdciiciicc{d}iciicdc{i}ddc{d}iciiiicdcciicddcddciicdciiiciiicdddcddddciiiiicddcicciiicddcdddciiiicddcdddcicddciiiiiiccddddcdddciiiciiiicicc{d}iiciiiiicddciicddddc{i}dddcddddccddcdc{i}ddc{d}iciiicdddciiciiiiccdddciiiiiccdcdddciiiicicddcdddciiiiciccddddcdddddccc{i}ddcddddddciiicdddddc{i}dddciicdc{d}iiciciiicciiicic{d}iiciiiiiiccddddddciciiiciiiicicddddddcdcddciiicddc{i}ddcddddddciiiiiic{d}iiiciiiicddddddc{i}dddcdcdddciiciiciic{d}iiicddciciiiiicdddciiiic{d}iiic{i}dddc{d}iiiciiiicddciiiiiicdddcdddciiiicdddddciiiiiciiicdddddcddciiiiicddddccciicdcdcdciiicddciiiicicddddddciiiicdddddciiiciiciicddddcddciiiccdddddciiccciiciiiiicddddddciiicddddcddciiicdddc{i}ddciccddddcicddcddciiiiicddcdddcdciiiiicciic{d}iiicdciiciiiiiccicdddciiiicdddciiccddddddciiccdciiiic{d}iiiciiccicdddciiiiicddcdciiiiicdddddciicdciiiicdddciiiicddddddciiiiiic{d}iiciiciiiiiicicddddddcciiiiiicdddcddddddciiiiiicddcdcddciiiccdcdciiiiicdddddciiiiiicdddcdddcciiiiiccddcdciiiiicdcdddcdciicdddddciiiiciic{d}iiiciiiciiciiicdddcdddddcciiciiiicdcddddciiciicddccciicdddddcc{i}dcddddcdcddddc{i}dddcddcdciicdcdccdddc{i}ddcdcdddcdddciiicicddddciiicdciiiccdcdddddcdciicddciiiiiicddciicddddciiicdciiiiicdddddcdciiiiiicdcdcciicdddddcicddciiiicdddddcicccdddciicddciiiiiicdddcdddciiiiiiciicdddciiiicdddciccdddcdddcdciiiicddddc{i}ddcc{d}iic{i}dddcdciiic{d}iiicicdciiiiciiic{d}iciiiiiicdddddciiiiiciicdcddddciiiic{d}iiicic{i}dddccddcddddcdciiiiicdddddcciiiciiiicdc{d}iiic{i}dddccdddddc{i}dddcdddcdddddccdcicicddc{i}dddcdcdddcicddcc{i}dddcddddcdcdddciiccdciciiiciic{d}iiciiiicdcdddciiiicciicdcdddc{i}dddcddcdcdddciiiiicdcdddddciiciciiicccdcddddddc{i}ddc{d}iiciiicdciiiicddddciciiiciiccdddddcddddciiiiiicdddcdciiicdddddc{i}dc{d}iiicddciiiiciiccdddddc{i}dddcddddcddddcciiicddciiiiiicddddciiciiicddccddddddciiciiccdddcdc{i}dddcddcddciiiiicddddciiicdddciiiicddddddcccdcdciicciiiicicccddddcddciiicicdddddcciiiciiicddddciicddciiiicddddddc{i}dcc{d}iiiciciiiicdddddcdciiiicicdddciicdciicddddciiciiccddddcciiiiiicic{d}iciiciiiicdddddcicicdddc{i}ddc{d}iiic{i}dddc{d}iiic{i}ddc{d}iiicdciiiciiiiccdddcddcdcdc{i}ddcdcddddcicdddciiiicdddccddciiiiiicddddddciiiiiciiccdcddddddc{i}ddc{d}iiciiciiiicicic{d}ic{i}dddcddddciiicdddciiiicdddddciciiiiiicdddcddddciiiiicdciiccc{d}iiiciiiiicddciicdcddcddciiiciiiiicdddddcddddciiiciiiiiicddcdddddcccddc{i}dddcddddcciiiiicddddciiicddddddciiiicddciiiiccdddccdddc{i}dddcddddciiiiicddddcdddddciiiiiicccdddcciiiicdcdciciiic{d}iiiciiiiiic{d}iiiciiiciiicddccdddciciiiiiic{d}iiciiiicdccicicicdddddc{i}dddcdcddccdddciiicdccdddddc{i}dddciicdddcddddcdccic{i}dddc{d}icicciiiiiiccddddciiciiiicdc{d}iiiciiiiicddddciiciiciiic{d}iiciiicdddciicddciiiiiicdcdddciiiiiic{d}iiciiiiiic{d}iiicciiiiiicdddciiiiicdddcddciiicciccddddciiiiiicdddciic{d}iiciiiiiicdcddcddcc{i}dddcicddciic{d}iciiiiciiiicddcddddciiiiicdcdcdddciiciicddddcciciiciciic{d}iiic{i}dddcicddddddcdciiciicdcdcdddciiciiciiiicdcc{d}iic{i}ddc{d}iiiciciiicdddddc{i}ddcdddciiicc{d}iiicdciiiicdcicicddddciiicdddciiciiciiiicdddciiic{d}iiciiciiiiiicdcdddddcddciiciiciiiicdcddddddcddciiciiiciiccdddcddciicdddciiicicicdciiiccddcddddddciiicciciiiiic{d}iiciicdciiiiciiicddcddciiiic{d}iciiiiciiiicddcddddcciiciiiiic{d}iiiccdciiicdddciiiiiciiicddddddcdddciiiicddciiciiicic{d}iiiciiiiicddccdddciiiiicicddciiiicddddciiicdcdddddciiicicddddddciicciiiiiciicc{d}iicciiiciiciicdcddcdddddciiiciiiiic{d}iiciic{i}dddc{d}iiciiiiicddddddc{i}dddc{d}iiic{i}ddc{d}iicciiiiiciiicddddciiiiic{d}iiciiiccdddcicddciciiciciiicddddddciiiiciicdddciciiiic{d}iciiiiciiicddddcddciiiccdciiiiicc{d}iiiciiiiciiciicdddcdddddcciiiiicdddciiciiicdddddciicicdddddciiiiiicddddddc{i}ddcdcdddddciiiicicic{d}iccciiciiiiic{d}iiiciiiiicdcddddciiicdc{i}dddc{d}iciiiiciiicdciiicdddcdddddc{i}dddcddddddcc{i}dddcddddcddcddciiiiciiiicddccdcddddciiiiiicdddddciiiiiicddcdddddciiicicdcdddciiicdddddciiicddc{i}dddcddcdddddciiiiiiciicdddcddddc{i}dddcdddddciiiiic{d}iiic{i}dddcddcdddcddddciciiiiicdddciiiiicddcdciiccdddciiiccdcdddddciiiciicddciiicdddddciiicdcdddc{i}dddcic{d}iccc{i}dddcddddddc{i}ddc{d}iiciiicicddddciiiicddddciiiicciiicdcciic{d}ic{i}dc{d}icciiciiiiicddcciiic{d}iiciiiiiicdciiciicdcddddddciiciiiiicddddciiiicdcdddddcddc{i}ddcdccddddcddcddciiiiiiciiicddcddddciiciiicdddddciicdcddddc{i}dcddddddciciiiicdddddciiiiiic{d}iciiiciiiiicic{d}iciciiicddddciiiicdcdciicicciiiicdddccdcdddciicdciciiiicddciiicddddddcddcc{i}ddcdcddddddciicddddciiiicdddcdciic{i}dddcdcdddciiicdddcddcdddciiicicicddddciiciiicdddcddc{i}ddc{d}iiiciiiiiicdddddcciiiiiic{d}iiciiicddddciiiiiicddddddciiiciciicdddddcdciiiiiiciiicdcddddddc{i}dddccdddddciiciiic{d}iciiiiiicdddciicdddddc
C# (Visual C# Interactive Compiler), 301 bytes
using C=System.Numerics.BigInteger;int i=-1,j,d=0;C u=new C(1);var z=Enumerable.Range(2,2000).Where(x=>{for(j=2;x%j>0&j++<x;);return x<j;}).ToList();var g="58322536285290033985886806240808836417438318459".Aggregate(u,(a,o)=>a*z[i+=o-47])+"";Write(z.Take(129).Aggregate(u,(a,b)=>a*C.Pow(b,g[d++]-48)));
Saved a byte thanks to ceilingcat
Pyth, 95 94 bytes
*Fm^hdsedC,.fP_Z129)`i."0z9í¶&¸¨÷)j3 &é¾~à\B,5ß@XHZ~õÎòF23U÷_e@ä×ß²j½¾"36
Starts with the number at the end of step 3.
Explanation:
*F # multiply all elements of
m # map
^hdsed # first element to the str(last element) power
# over
C, # zip
.f 129) # first 129
P_Z # primes
# with
."0...¾" # packed string
i 36 # convert from base 36 to int
` # convert to string
# (i.e. each prime with each char)
bc 1.07, 147 bytes
I haven't found any documentation on this version, but it seems to allow input bases of up to 36.
ibase=36
i=r=p=1
for(c=NT35WE2NF68SLMVUQIHDYNG22V9938091UQB6B4RLISCQDMPA9EPP1AVLANPVVX0J0DWW68XTA7C93PC8A1;c;p*=i*i){if(p%++i){r*=i^(c%A);c/=A}}
r
The primes are generated using Wilson's theorem. Ungolfed:
# all literals are in base 36
ibase = 36
# the result is calculated in r
r = 1
# i is the current prime candidate, p=factorial(i-1)^2
i = p = 1
# c is the result of step 3 with reversed digits
c = NT35WE2NF68SLMVUQIHDYNG22V9938091UQB6B4RLISCQDMPA9EPP1AVLANPVVX0J0DWW68XTA7C93PC8A1
while(c) { # until c is 0:
if(p % ++i){ # (increment i) if i is a prime
r *= i^(c%A) # take i to the power of the last digit of c and multiply to r
c /= A # remove the last digit from c
}
p *= i*i # update the squared factorial
}
r # print the result
Python 3, 349 bytes
eval(eval('"19805596543926073442*"+"78873566720902235*18013318998359734663*"*2+"593140350139852859*8104731785668783073*"*3+"6644372255178073982360301*"*4+"1353238597766773*12805823735079030233*"*5+"6662348615646027385791148837*"*6+"13372864637471*7423896006336743*"*7+"14127919992957378413027*"*8+"74874566303993533*2096862721178836784989*"*9+"1"'))
Fork of @ZaelinGoodman's powershell solution
Python 3.7, 240 174 bytes
p=str(int('3ged5xs20knlms4j3eaoxfzn5wdy54rml7sjp9f2pdhuoqdmky310zhxpta29r51libwivktdzfdpr2lcn1',36))
d=0
n=W=o=1
exec('W*=n;n+=1\nif~-n==W%n:o*=n**int(p[d]);d+=1\n'*726)
print(o)
Original 240 byte answer:
p='142994592871080776665367377010330975609342911590947493672510923980226345650368095529497306323265234451588273628492018413579702589'
d=0
n=2
W=1
o=1
while n<728:
W=W*(n-1)
if W%n==n-1:
o=o*n**int(p[d])
d=d+1
n=n+1
print(o)
Julia 0.4, 123 129 bytes
show(prod(big(primes(727)).^digits(parse(BigInt,"sADsqNdwRYpd0LiTS4dgSvAP9BD2FkP9a9PLVt4ZGbbmxFCrkG4TEZI1ajJfYfdCycXNu6BN",62))))
I'm using Julia 0.4 because primes was a built-in function in this version.
It would be nearly identical with a modern version of Julia and the package Primes.jl
Starting at step 4 but with the reversed number in base 62:
985207975314810294826372885154432562323603794925590863056543622089329015276394749095119243906579033010773763566677080178295499241
Python 2, 151 bytes
This is two bytes shorter than my previous answer, thanks to an insight from @xnor.
x=r=n=2
for c in"!NwXv\erA$xV}G_sTJBDRPR;V\!=[u,4bzroe_:\0Ik X4;d.d":n=n<<7|ord(c)
while n:
x+=1
if~-2**x%x<2:r*=x**(n%10);n/=10
print r
Due to Python's verbosity, it seems best to directly use the number from the end of step 3, instead of computing it. Fermat's primality test can be used to calculate the primes. For some pseudoprime numbers (namely 561, 645, 341) the test fails, in which 0 is used as the exponent instead.
Python 2, 158 153 bytes
-2 bytes thanks to @ovs
-3 bytes thanks to @Sisyphus
a=b=r=n=1
for c in"c!U!u5uk^CvmInk~)3Ii0@45x:ja'eh?tMSmwPDQK%a":n=n*129+ord(c)
while n:
if a%b:r*=b**(n%10);n/=10
a*=b*b;b+=1
print r
Primes are found using Wilson's theroem.
This first attempt is mildly golfed, but represents an authentic implementation of the spec. The final number is split into multiple lines, each terminated by \ (as per normal bc output). If this is not acceptable, I can add a few more bytes to make it all one line.
Bash + common linux utils, 241
m()(paste -sd* -|bc)
r=primes
printf 1$($r 1 1800|sed -nf <(for p in $(printf UNSHARPENED|od -An -w1 -td1|awk '{print 1000*NR+11360+$1*10}');do
$r $p|sed 1q
done|m|sed s/./\&+1+p/g|dc|sed s/$/p/)|m|sed 'N;s/\\\n//;s/./*%s^&/g') $($r 1 728)|m
The above gives some good starting points to get golfing. Here we skip straight to step 3:
Bash + common linux utils, 186
m()(paste -sd* -|bc)
printf 1$(primes 1 1800|sed -nf <(sed s/./\&+1+p/g<<<58322536285290033985886806240808836417438318459|dc|sed s/$/p/)|m|sed 'N;s/\\\n//;s/./*%s^&/g') $(primes 1 728)|m
Skipping to step 4 is a little longer:
Bash + common linux utils, 191
printf 1$(sed s/./*%s^\&/g<<<142994592871080776665367377010330975609342911590947493672510923980226345650368095529497306323265234451588273628492018413579702589) $(primes 1 728)|paste -sd* -|bc
But the best seems to be representing the step 4 input as hex, and splitting (to work around dc/bc output length limits):
Bash + common linux utils, 177
printf 1$(dc<<<16i15B99C0EC8211C220ED814252AE350B502C02270461072F62C9A4CCn8CDAF145DAB65AE8478B533CCF0F1E3364D943BA2D9FFA4E913Dn|sed s/./*%s^\&/g) $(primes 1 728)|paste -sd* -|bc
Husk, 54 53 bytes
Πz`^İpdΠm!İptGo→+0dΠz(`ḟİp≥*10+*100)→½ḣ23mo-96c¨unẇṗ±
Uses the complete method as described.
Step 1:
mo-96c¨unẇṗ±
Subtract 96 from the character values of each letter in the compressed string ¨unẇṗ± = 'unsharpened'.
Step 2:
Πz(`ḟİp≥*10+*100)…13 23
Zip previous list with 13...23 by multiplying arg2 by 100, adding arg1, multiplying by 10, and getting the first prime greater-or-equal to this; then take the product.
Step 3:
Πm!İptGo→+0d
Get decimal digits, and scan (sequentially apply function to each element and previous result, keeping intermediate results) by adding and incrementing; then get the primes at these indices and take the product.
Step 4:
Πz`^İpd
Get decimal digits, zip with list of primes by taking exponent; then take the product.
05AB1E, 40 bytes
•3^—Ð7η¨Á∊δ¿x₅т«n¹L°;₄•11вÅ»+}ØPSDgÅpsmP
•...•11вÅ»+}ØPSDgÅpsmP # trimmed program
P # push the product of...
# (implicit) each element of...
Åp # the first...
g # length of...
P D # the product of...
Ø # the primes with indices in...
Å» # cumulative...
+ # sums...
Å» # to the right of...
в # list of base...
11 # literal...
в # digits of...
•...• # 4693500063420580072723276169489497775909790306646...
Åp # primes...
m # to the power of...
# (implicit) each element of...
S # digits of...
P s # the product of...
Ø # the primes with indices in...
Å» # cumulative...
+ # sums...
Å» # to the right of...
в # list of base...
11 # literal...
в # digits of...
•...• # 4693500063420580072723276169489497775909790306646
} # end cumulative operations
# implicit output
Bubblegum, 606
Generated with zopfli --i1000 --deflate -c ginormous.txt | xxd.
I honestly thought bubblegum might do a bit better than this, but here it is:
0000000: 1d4e 0711 c030 08b4 04bf 00ff c67a 6976 .N...0.......ziv
00000010: e057 1795 0a7b ccc5 8ccf ba25 5a17 63f7 .W...{.....%Z.c.
00000020: 04ba d74c c30c 1745 25bc f2d1 5dad 3480 ...L...E%...].4.
00000030: 4a59 dbe7 19d5 ead4 2e35 66e6 0a33 67ad JY.......5f..3g.
00000040: a6bb b4a3 600f b93a bb59 98eb 1257 b757 ....`..:.Y...W.W
00000050: 1937 e03c a999 c457 15c9 73b1 d26c 35ab .7.<...W..s..l5.
00000060: 7527 b461 b946 d3a8 5155 fc70 13b0 c6e3 u'.a.F..QU.p....
00000070: 78ee 0a7d 25d2 6cc2 eb8e ec0d c760 cfb0 x..}%.l......`..
00000080: 38bb 65ba 577a 5816 12ee 8ef6 de3e 57d5 8.e.WzX......>W.
00000090: c235 b7d5 d26c 25d5 da23 8a7d 3ca4 26f4 .5...l%..#.}<.&.
000000a0: 1caa c3a9 2961 8d74 4e18 9216 61ce 22ad ....)a.tN...a.".
000000b0: ac60 1700 1d83 623d 8b08 6374 b25d 9859 .`....b=..ct.].Y
000000c0: 5f76 2171 0a60 9918 88a3 c516 f6c8 4b45 _v!q.`........KE
000000d0: 6ce9 75d6 c08c 756b a53d 45af ab10 37fd l.u...uk.=E...7.
000000e0: fcab ceaa b162 a96f 0d07 d64c ba50 5160 .....b.o...L.PQ`
000000f0: 9d78 3b73 3207 245f 8395 f565 465d aadd .x;s2.$_...eF]..
00000100: 9a1c 885c a5b3 c3a9 de0d 3add daa9 195c ...\......:....\
00000110: baab 5113 0a38 ab49 305b 6249 316e c21d ..Q..8.I0[bI1n..
00000120: c8bb 3b7d 2d0e 3577 aa10 ae43 29e9 5515 ..;}-.5w...C).U.
00000130: 7be8 4d0a 52d7 98ab d102 e802 3233 6cb9 {.M.R.......23l.
00000140: 8a81 90ba 0307 edd0 0a94 007b 8534 58db ...........{.4X.
00000150: db87 d6ae 89be 9511 b2a7 f367 68ce 5e0d ...........gh.^.
00000160: c301 2f98 ec6e 4731 5ba7 e20d 801a 7235 ../..nG1[.....r5
00000170: 6dce 48bd 3a57 1272 e21c b635 3678 6dc9 m.H.:W.r...56xm.
00000180: 19dc 268c 5d73 4137 aeba 67e8 db0e 946b ..&.]sA7..g....k
00000190: 357b c2eb a90a d74c 6678 d97a c6bd 3757 5{.....Lfx.z..7W
000001a0: da60 6228 009d ed3d 42b1 fa09 6d6d c3b5 .`b(...=B...mm..
000001b0: deed 12e5 feeb b9e6 2d7f 080a 9e11 d472 ........-......r
000001c0: bc9b 2275 4de4 c6bf 3ea0 035a 9d63 099a .."uM...>..Z.c..
000001d0: ed48 9df1 7907 4e01 73d7 adec b8b8 85eb .H..y.N.s.......
000001e0: d4d4 5679 752d 35aa a969 8f9e e6b0 25ee ..Vyu-5..i....%.
000001f0: b6e7 d21d 7ae9 f4f4 2d67 afaa 3065 15f1 ....z...-g..0e..
00000200: c0b9 f402 67b6 6f26 58de b335 5cec 4dcf ....g.o&X..5\.M.
00000210: 05a7 c38d aac3 8d67 3493 5634 b0fa 979c .......g4.V4....
00000220: be96 db6d efcc d53d 177b 2b9e 5be8 7ccb ...m...=.{+.[.|.
00000230: be5d a172 f367 521d b5bc e25e b54a 84ec .].r.gR....^.J..
00000240: 4b0c 519b 63f7 e396 ba70 eb35 8b72 33ec K.Q.c....p.5.r3.
00000250: c392 d7aa 1495 aedc e24e b90a 5d1f .........N..].
Python 3.8, 207 \$\cdots\$ 192 188 bytes
Saved 3 5 bytes thanks to user202729!!!
Saved a byte thanks to the man himself Arnauld!!!
Saved 4 bytes thanks to att!!!
Saved 4 bytes thanks to ovs!!!
from math import*
p=[n for n in range(2,1710)if perm(n-1)**2%n];i=s=1
for n in str(int("S87MGJSI5MYQMC8O1HDMTTI1EE4FWB",36)):i-=~int(n);s*=p[i]
print(prod(p.pop(0)**int(b)for b in str(s)))
Prints the ginormous number by computing it starting with a slightly altered version of the huge number from the \$2^{\text{nd}}\$ step.
05AB1E, 36 bytes
Only the first step is hardcoded. Thanks to Kevin Cruijssen for helping with this!
∞<Ø•BIº£¡P°•₂вā12+т*+T*ÅNPS>ηO<ØPSmP
Commented:
# step 1:
•BIº£¡P°• # compressed integer 3044554559124550
₂в # convert to base 26 digits
# [21, 14, 19, 8, 1, 18, 16, 5, 14, 5, 4]
# step 2:
ā # get a range from 1 in the same length as the result from step 1
12+ # add 12 to each value
т* # multiply by 100
+ # add element-wise to the result of the first step
T* # multiply each value by 10
ÅN # find the next prime
P # take the product
# step 3:
S # split into digits
> # increment each digits
ηO # take the sum of each prefix of this list
< # decrement every sum
Ø # take the 0-based nth prime
P # take the product of the primes
# step 4:
∞ # push infinite list [1, 2, 3, ...]
< # decrement each value
Ø # take the 0-based nth prime
... # this list of primes is at the bottom of the stack during all other steps
S # split the result of the third step into digits
m # raise each prime to a digit power
P # take the product
05AB1E, 36 bytes
The first 2.5 steps are hardcoded.
∞<Ø•1‘;67₃в©¾ΛM„ØΩüñïΩ'ÿ•.¥āÌÌ+ØPSmP
Commented:
∞ # push infinite list: [1, 2, 3, ...]
< # decrement each value
Ø # for each number, get the 0-based nth prime: [2, 3, 5, ...]
# this prime list will be needed in the last step
•1...ÿ• # large compressed integer
.¥ # take the cumulative sum of the digits
ā # push a range of the same length: [1, 2, ..., length]
ÌÌ # add 4 to each value: [4, 5, ..., length+4]
+ # add this element-wise to the cumulative sums
# this results in the list from step 3
Ø # take the nth primes (0-based)
P # take their product
S # split into digits
m # for each digit, raise a corresponding prime to this power
P # take the product
JavaScript (Node.js), 149 bytes
d=>(F=n=>[...n+''].map(h=v=>(g=k=>x%--k?g(k):k>1)(++x)||!d&&v--?h(v):p*=x**BigInt(d?v:1),p=x=1n)&&p)(d=F(0xA3745E1D28D1E3702D3F5F1E336A3F1A64F7F7Bn))
How?
The result of the 2nd step is hard-coded as a BigInt in hexadecimal:
0xA3745E1D28D1E3702D3F5F1E336A3F1A64F7F7Bn
The 3rd and 4th steps are similar enough to be processed with the same helper function F, whose exact behavior depends on the flag d.
d =>
// 4th step: invoke F with d truthy
F(
d =
// 3rd step: invoke F with d falsy (undefined)
F(0xA3745E1D28D1E3702D3F5F1E336A3F1A64F7F7Bn)
)
Where F is defined as follows:
F = n => // F is a helper function taking a BigInt n
[...n + ''] // turn n into a list of digits
.map(h = v => // h is a recursive callback; for each digit v:
( g = k => // g is a recursive function taking a divisor k:
x % --k ? // decrement k; if k is not a divisor of x:
g(k) // do recursive calls until it is
: // else:
k > 1 // return true if k > 1, i.e. x is composite
)(++x) // initial call to g with k = x incremented
|| // if x is composite
!d && v-- ? // or d is not set and v is not equal to 0:
h(v) // do a recursive call to h
: // else:
p *= // multiply p by
x ** BigInt( // the prime x raised to the power of
d ? v : 1 // either v if d is set, or 1 otherwise
), //
p = x = 1n // start with p = x = 1
) && p // end of map(); return p
J, 83 bytes
*/(p:@i.@#^x:)"."0":*/p:<:+/\1x+"."0":4*/@p:((1e3*12+#\)+10*_64x+3&u:)'UNSHARPENED'
This is just a straightforward translation of the steps in reverse.
Charcoal, 99 83 64 bytes
≔…²⊗φθF⁴²≔⁻θ×θ⁺²ιθIΠEIΠE⁴⁷§θ⁺κΣ…”)¶↘…⊘¤|⟧≦?Lν~⊘θ¿nê₂ηYx”⊕κX§θκIι
Try it online! Link is to verbose version of code. Would take 570 bytes as a compressed string literal. Explanation:
≔…²⊗φθF⁴²≔⁻θ×θ⁺²ιθ
Find all the primes below 2000 by multiplying the range from 2 to 2000 by all integers from 2 to 43 and taking the set difference.
IΠEIΠE⁴⁷§θ⁺κΣ…”)¶↘…⊘¤|⟧≦?Lν~⊘θ¿nê₂ηYx”⊕κX§θκIι
Add the digital sum of each nontrivial prefix of the compressed string literal to the current index and use that to index into the primes. Cast the product of those primes to string. For all of this string's digits, take the prime at that index and raise it to the power of that digit. Print the final product.
Previous 99 80-byte solution also performed steps 1 and 2. (I also tried step 4 only, but that took 103 84 bytes.)
≔…²⊗φθF⁴²≔⁻θ×θ⁺²ιθ≔IΠEUNSHARPENED⌊ΦEχ⁺λ⁺×⁺¹³κφ×⊕⌕αιχ⬤θ﹪λνηIΠEIΠEη§θ⁺κΣ…η⊕κX§θκIι
Try it online! Link is to verbose version of code. Explanation:
≔…²⊗φθF⁴²≔⁻θ×θ⁺²ιθ
Find all the primes below 2000 by multiplying the range from 2 to 2000 by all integers from 2 to 43 and taking the set difference.
≔IΠEUNSHARPENED⌊ΦEχ⁺λ⁺×⁺¹³κφ×⊕⌕αιχ⬤θ﹪λνη
Take the word UNSHARPENED and look up the 1-indexed letter values, multiply by 10, add 1000 times the 0-indexed position, and add the range 13000..13009. Filter out any elements of that range that are divisible by any prime below 2000, and take the minimum of the remainder. Multiply these together and cast the result to string.
IΠEIΠEη§θ⁺κΣ…η⊕κX§θκIι
For all the digits in the string, add the digital sum so far to the current index and use that to index into the primes. Cast the product of those primes to string. For all of this new string's digits, take the prime at that index and raise it to the power of that digit. Print the final product.
Jelly, 39 bytes
ØaiⱮ“Œɱl»DŻ-.ịƊ€J+12Ɗ;"$V×⁵ÆnPD‘ÄÆNPDÆẸ
A direct translation of the specification. Compressing the output as a base-250 integer is 571 bytes:
-6 bytes (indirectly) thanks to ais523's answer
Jelly, 33 bytes
13r23×ȷ
“Œɱl»ØaiⱮ⁵×¢+ÆnPD‘ÄÆNPDÆẸ
Full program, outputting to standard output.
Explanation
So, it turns out that at least in Jelly, it makes sense to go all the way through the process right from the start, rather than encoding the steps one at a time.
13r23×ȷ
r inclusive range from
13 23 13 to 23
×ȷ multiply each element by 1000 (giving 13000, 14000, … 23000)
“Œɱl»ØaiⱮ⁵×¢+ÆnPD‘ÄÆNPDÆẸ
“Œɱl» "unsharpened" (specified via dictionary index)
i take 1-based index of
Ɱ each letter
Øa in the lowercase alphabet
× multiply each of those indexes by
⁵ 10
+ add {corresponding elements of}
¢ the constant computed on the preceding line
Æn take the next prime {above each element}
P take the product
D express as decimal digits
‘ increment each digit
Ä take cumulative sum
ÆN take the nth prime {for each element n}
P take the product
D express as decimal digits
ÆẸ interpret as exponents of consecutive primes
Yes, turns out step 4 is actually a Jelly builtin!
It's obvious that calculating steps 3 and 4, rather than hardcoding the result, gives savings; likewise for most of step 2 (the rule for encoding the offsets of 13000, 14000, etc. is fairly verbose but much smaller than the offsets themselves). My second-best attempt hardcodes the output just after the ⁵× (the numbers are all under 250 so can be written as a byte each), but it's still slightly more verbose than starting from the start:
“Ż⁼ȦP½Ṇɦ2⁼2(‘ [210, 140, 190, 80, 10, 180, 160, 50, 140, 50, 40]
“Œɱl»ØaiⱮ⁵× alphabet indexes of "unsharpened", times 10
(Another possibility would be to use base conversion, but this ends up even longer because there's no terse way to specify the base, and you still need to spend two bytes for the multiplication by 10.)
Python 2, 1370 bytes
print 10346063175382775954983214965288942351853612536382034663905935101461222060548195774084941504127779027795484711048746289269095513027910438498906751225648197766590064457965461314130149942152545074712074006545797623075756579902190433531325851645586375231773037880535184421903026638874897489950008250798014478066014893203193926076357920163707042852616942733354325378261468425502224936203089956427521668102778596882443702230532724374828028933960643144327285227754985461570358500265135333500954075465441985256254776102064625494398779453723330206306859677410408807692326906168737018862161148707729611012076342295413323680430446529763872458887191437347994063250920466184003173586602441075384748222102267773145003624260992372156354624662289026123081819214885321984526331716887191378907363723962768881646531494039722207338471537744184950666337656928147552391544567298663655079621129011773598162469141317639170063853667739680653118979048627652462235681893246541359880812508588104345141359691398313598202577424145658860334913269759048622492214169304247816441675958725602279911468750380291607080058491441201347157459047314438815796116358356171983789000270540329047696182295315977628397256525031861796294929740163865774776146472541890007191451515587790900275580657982495983198842069735835409348390389014043245596652434869311982404102985853034513631928339140603461069829946906350