! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel math math.ranges
- namespaces project-euler.common sequences ;
+USING: arrays kernel math ranges namespaces project-euler.common
+sequences sequences.extras ;
IN: project-euler.039
! http://projecteuler.net/index.php?section=problems&id=39
! {20,48,52}, {24,45,51}, {30,40,50}
-! For which value of p < 1000, is the number of solutions maximised?
+! For which value of p < 1000, is the number of solutions maximized?
! SOLUTION
: euler039 ( -- answer )
[
- 1000 count-perimeters p-count get [ supremum ] keep index
+ 1000 count-perimeters p-count get arg-max
] with-scope ;
! [ euler039 ] 100 ave-time