Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import "/math" for Int
import "/big" for BigInt
var list = (2..20).toList
list.add(65)
for (i in list) {
if (Int.isPrime(i)) {
System.print("HP%(i) = %(i)")
continue
}
var n = 1
var j = BigInt.new(i)
var h = [j]
while (true) {
var k = BigInt.primeFactors(j).reduce("") { |acc, f| acc + f.toString }
j = BigInt.new(k)
h.add(j)
if (j.isProbablePrime(2)) {
for (l in n...0) System.write("HP%(h[n-l])(%(l)) = ")
System.print(h[n])
break
} else {
n = n + 1
}
}
}

View file

@ -0,0 +1,28 @@
/* home_primes_gmp.wren */
import "./gmp" for Mpz
import "./math" for Int
var list = (2..20).toList
list.add(65)
for (i in list) {
if (Int.isPrime(i)) {
System.print("HP%(i) = %(i)")
continue
}
var n = 1
var j = Mpz.from(i)
var h = [j.copy()]
while (true) {
var k = Mpz.primeFactors(j).reduce("") { |acc, f| acc + f.toString }
j = Mpz.fromStr(k)
h.add(j)
if (j.probPrime(15) > 0) {
for (l in n...0) System.write("HP%(h[n-l])(%(l)) = ")
System.print(h[n])
break
} else {
n = n + 1
}
}
}