: do-tick ( indices scores -- indices' scores' ) 2dup nths sum 1 digit-groups [ { 0 } ] when-empty append! 2dup nths { 1 1 } v+ rot v+ over length [ mod ] curry map swap ; : part1 ( -- ) { 0 1 } V{ 3 7 } clone [ dup length 607341 < ] [ do-tick ] while 607331 tail 10 head . drop ; : part2 ( -- ) { 0 1 } V{ 3 7 } clone 100,000,000 [ do-tick ] times nip 6 [ { 6 0 7 3 3 1 } sequence= ] find drop . ;