Home primes: Difference between revisions

(→‎{{header|Wren}}: Now uses Pollard Rho to help with factorization. About 150 times quicker than before.)
(→‎{{header|Wren}}: Added HP65.)
Line 211:
This uses a combination of the Pollard Rho algorithm and wheel based factorization to try and factorize the large numbers involved here in a reasonable time.
 
Reaches HP20 in about 0.52 seconds but HP65 istook probablyjust outunder of40 reasonable reach.minutes!
<lang ecmascript>import "/math" for Int
import "/big" for BigInt
Line 296:
}
 
forvar (ilist in= (2..20) {.toList
list.add(65)
for (i in list) {
if (Int.isPrime(i)) {
System.print("HP%(i) = %(i)")
Line 339 ⟶ 341:
HP19 = 19
HP20(15) = HP225(14) = HP3355(13) = HP51161(12) = HP114651(11) = HP3312739(10) = HP17194867(9) = HP194122073(8) = HP709273797(7) = HP39713717791(6) = HP113610337981(5) = HP733914786213(4) = HP3333723311815403(3) = HP131723655857429041(2) = HP772688237874641409(1) = 3318308475676071413
HP65(19) = HP513(18) = HP33319(17) = HP1113233(16) = HP11101203(15) = HP332353629(14) = HP33152324247(13) = HP3337473732109(12) = HP111801316843763(11) = HP151740406071813(10) = HP31313548335458223(9) = HP3397179373752371411(8) = HP157116011350675311441(7) = HP331333391143947279384649(6) = HP11232040692636417517893491(5) = HP711175663983039633268945697(4) = HP292951656531350398312122544283(3) = HP2283450603791282934064985326977(2) = HP333297925330304453879367290955541(1) = 1381321118321175157763339900357651
</pre>
9,482

edits