! Copyright (c) 2008 Eric Mertens ! See http://factorcode.org/license.txt for BSD license. USING: arrays assocs kernel math math.ranges sequences ; IN: project-euler.164 ! http://projecteuler.net/index.php?section=problems&id=164 ! DESCRIPTION ! ----------- ! How many 20 digit numbers n (without any leading zero) exist such ! that no three consecutive digits of n have a sum greater than 9? ! SOLUTION ! -------- assoc ; PRIVATE> : euler164 ( -- n ) init-table 19 [ next-table ] times values sum ;