Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion euler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ problem03
problem04
problem05
problem06
problem07
problem07
problem09
21 changes: 21 additions & 0 deletions euler/problem09.porth
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include "std.porth"

macro sum 1000 end

sum
1 while over over >= do
1 while over over >= do
2dup over dup * over dup * +
rot rot
+ sum swap -
if 2dup dup * = do
swap drop print
2dup swap print print
0 exit // can be commented to test that it's the only one solution
else
2drop
end
1 +
end drop
1 +
end 2drop
11 changes: 11 additions & 0 deletions euler/problem09.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:i argc 0
:b stdin 0

:i returncode 0
:b stdout 12
425
375
200

:b stderr 0