Jump to content

Home primes: Difference between revisions

m
→‎{{header|Raku}}: oops, fencepost error
(→‎{{header|Raku}}: Plagiarize underscore separator idea from Phix, add some basic timing info., do partial HP49)
m (→‎{{header|Raku}}: oops, fencepost error)
Line 296:
Not the fastest, but not too bad either. Make an abortive attempt at HP49.
 
Assuming there are n steps; HP49(n - 2625) is slow, HP49(n - 3231) is ''really'' slow, and I gave up on HP49(n - 3534) after 45 minutes.
 
Using [https://modules.raku.org/search/?q=Prime+Factor Prime::Factor] from the [https://modules.raku.org/ Raku ecosystem].
Line 320:
while (@factors = prime-factors @steps[*-1].Int) > 1 {
@steps.push: @factors.join('_');
say "HP{@steps[$step].Int}\(n - {++$step++}) = ", @steps[*-1], " ({(now - $now).fmt("%0.3f")} seconds)";
$now = now;
last if $step ==> 30;
}</lang>
{{out}}
Line 343:
HP18(1) = 2_3_3 (0.000 seconds)
HP19 = 19 (0.000 seconds)
HP20(15) = HP2_2_5(14) = HP3_3_5_5(13) = HP5_11_61(12) = HP11_4651(11) = HP3_3_12739(10) = HP17_194867(9) = HP19_41_22073(8) = HP709_273797(7) = HP3_97_137_17791(6) = HP11_3610337981(5) = HP7_3391_4786213(4) = HP3_3_3_3_7_23_31_1815403(3) = HP13_17_23_655857429041(2) = HP7_7_2688237874641409(1) = 3_31_8308475676071413 (0.029020 seconds)
HP65(19) = HP5_13(18) = HP3_3_3_19(17) = HP11_13_233(16) = HP11_101203(15) = HP3_3_23_53629(14) = HP3_3_1523_24247(13) = HP3_3_3_7_47_3732109(12) = HP11_18013_16843763(11) = HP151_740406071813(10) = HP3_13_13_54833_5458223(9) = HP3_3_97_179_373_7523_71411(8) = HP1571_1601_1350675311441(7) = HP3_3_13_33391_143947_279384649(6) = HP11_23_204069263_6417517893491(5) = HP7_11_1756639_83039633268945697(4) = HP29_29_5165653_13503983_12122544283(3) = HP228345060379_1282934064985326977(2) = HP3_3_3_2979253_3030445387_9367290955541(1) = 1381_3211183211_75157763339900357651 (6.593686 seconds)
Total elapsed time: 6.651737 seconds
 
HP49:
HP49(n - 10) = 7_7 (0.000 seconds)
HP77(n - 21) = 7_11 (0.000 seconds)
HP711(n - 32) = 3_3_79 (0.000 seconds)
HP3379(n - 43) = 31_109 (0.000 seconds)
HP31109(n - 54) = 13_2393 (0.000 seconds)
HP132393(n - 65) = 3_44131 (0.000 seconds)
HP344131(n - 76) = 17_31_653 (0.000 seconds)
HP1731653(n - 87) = 7_11_43_523 (0.000 seconds)
HP71143523(n - 98) = 11_11_577_1019 (0.000 seconds)
HP11115771019(n - 109) = 311_35742029 (0.000 seconds)
HP31135742029(n - 1110) = 7_17_261644891 (0.000 seconds)
HP717261644891(n - 1211) = 11_19_3431873899 (0.002 seconds)
HP11193431873899(n - 1312) = 11_613_4799_345907 (0.001 seconds)
HP116134799345907(n - 1413) = 3_204751_189066719 (0.001 seconds)
HP3204751189066719(n - 1514) = 3_1068250396355573 (0.003 seconds)
HP31068250396355573(n - 1615) = 621611_49980213343 (0.006005 seconds)
HP62161149980213343(n - 1716) = 3_3_6906794442245927 (0.005006 seconds)
HP336906794442245927(n - 1817) = 73_4615161567701999 (0.010009 seconds)
HP734615161567701999(n - 1918) = 3_13_18836286194043641 (0.009 seconds)
HP31318836286194043641(n - 2019) = 3_3_3_43_14369_161461_11627309 (0.005004 seconds)
HP333431436916146111627309(n - 2120) = 3_32057_1618455677_2142207827 (0.187153 seconds)
HP33205716184556772142207827(n - 2221) = 3_1367_2221_5573_475297_1376323127 (0.008006 seconds)
HP31367222155734752971376323127(n - 2322) = 7_3391_51263_25777821480557336017 (0.005003 seconds)
HP733915126325777821480557336017(n - 2423) = 47_67_347_431_120361987_12947236602187 (0.054043 seconds)
HP476734743112036198712947236602187(n - 2524) = 3_7_7_17_12809_57470909_57713323_4490256751 (0.168124 seconds)
HP377171280957470909577133234490256751(n - 2625) = 3096049809383_121823389214993262890297 (3027.753913 seconds)
HP3096049809383121823389214993262890297(n - 2726) = 7_379_62363251_18712936424989555929478399 (0.132 seconds)
HP73796236325118712936424989555929478399(n - 2827) = 13_1181_145261411_33089538087518197265265053 (0.032034 seconds)
HP13118114526141133089538087518197265265053(n - 2928) = 3_19_521_441731977174163487542111577539726749 (0.002 seconds)
HP319521441731977174163487542111577539726749(n - 3029) = 59_5415617656474189392601483764603009147911 (0.002 seconds)</pre>
HP595415617656474189392601483764603009147911(n - 30) = 13_8423_1466957_3706744784027901056001426046777 (0.015 seconds)</pre>
 
=={{header|Wren}}==
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.