! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
-USING: hints kernel locals math math.order math.ranges project-euler.common
- sequences sequences.private ;
+USING: kernel locals math math.order math.ranges math.statistics
+project-euler.common sequences sequences.private ;
IN: project-euler.150
! http://projecteuler.net/index.php?section=problems&id=150
! sequence helper functions
: partial-sums ( seq -- sums )
- 0 [ + ] accumulate swap suffix ; inline
+ cum-sum 0 prefix ; inline
: partial-sum-infimum ( seq quot -- seq )
[ 0 0 ] 2dip [ + [ min ] keep ] compose each drop ; inline