Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
fix solution of P35
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Apr 10, 2024
1 parent 17658c6 commit 9835ccc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Src/Problem35.lean
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def primeFactors (n : Nat) : List Nat :=
-- sorry
loop n 2 [] |>.reverse
where loop (tgt candidate : Nat) (acc : List Nat) : List Nat :=
if candidate <= 1 || tgt ≤ 1 then
if candidate <= 1 || candidate > tgt then
panic! "candidate is out of range"
else if tgt ≤ 1 then
acc
else if tgt % candidate = 0 then
loop (tgt / candidate) candidate <| candidate :: acc
Expand Down

0 comments on commit 9835ccc

Please sign in to comment.