Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -0,0 +1,39 @@
# home_primes.py by Xing216
def primeFactors(n: int) -> list[int]:
primeFactorsL = []
while n % 2 == 0:
primeFactorsL.append(2)
n = n // 2
for i in range(3,int(n**0.5)+1,2):
while n % i== 0:
primeFactorsL.append(i)
n = n // i
if n > 2:
primeFactorsL.append(n)
return primeFactorsL
def list_to_int(l: list[int]) -> int:
return int(''.join(str(i) for i in l))
def home_prime_chain(i:int) -> list[int]:
pf_int = i
chain = []
while True:
pf = primeFactors(pf_int)
pf_int = list_to_int(pf)
if len(pf) == 1:
return chain
else:
chain.append(pf_int)
for i in range(2,21):
chain_list = home_prime_chain(i)
chain_len = len(chain_list)
chain_idx_list = list(range(chain_len))[::-1]
j = chain_len
if chain_list != []:
print(f"HP{i}({chain_len}) =", end=" ")
for k,l in list(zip(chain_list, chain_idx_list)):
if l == 0:
print(f"{k}")
else:
print(f"HP{k}({l}) =", end=" ")
else:
print(f"HP{i}(1) = {i}")

View file

@ -1,5 +1,5 @@
import "/math" for Int
import "/big" for BigInt
import "./math" for Int
import "./big" for BigInt
var list = (2..20).toList
list.add(65)

View file

@ -1,4 +1,4 @@
/* home_primes_gmp.wren */
/* Home_primes_2.wren */
import "./gmp" for Mpz
import "./math" for Int