Liste des Groupes | Revenir à ol advocacy |
Project Euclid Problem is SOLVED!!!I don't understand. You say it's solved. So what did your code find? Which denominator under 1000 gives the longest repeating decimals if numerator is 1?
https://projecteuler.net/problem=26
Using the fantastically potent FOSS CAS Maxima/wxMaxima the solution
is a fucking snap:
max:1$
maxd:3$
for num:3 thru 1000 step 1 do (
d:1,
fact_list:ifactors(num),
for i:1 thru length(fact_list) do (
if not(fact_list[1] = 2 or fact_list[1] = 5) then d:d*fact_list[1]^fact_list[2]
),
if not(d = 1) then (
rep:zn_order(10,d), print("denom = ", num, "repeats = ", rep),
if (rep > max) then (max:rep, maxd:num)
)
else (print("denom = ", num, "terminating"))
);
print("Max rep =", max, "at denom =", maxd);
The output is not ideal, but hey, I am a fucking messy eater.
I spill my coffee. I slobber all over my shirt. But I ALWAYS
get the correct answer in the most efficient way and that's
ALL that matters.
Hail Linux!
Hail GNU, FOSS, and the FSF!
Hail Stallman!
Les messages affichés proviennent d'usenet.