Handbook
Glossary
(euler062) ( n assoc -- n )
Vocabulary
project-euler
.
062
.
private
Inputs
n
an
object
assoc
an
object
Outputs
n
an
object
Definition
USING:
arrays
assocs
kernel
math
sequences
;
IN:
project-euler.062.private
:
(euler062)
( n assoc -- n )
2dup
has-entry?
[
2dup
[
>key
]
dip
[
dup
0
swap
[
1
+
]
change-nth
]
change-at
2dup
[
>key
]
dip
at
first
5
=
[
[
>key
]
dip
at
second
]
[
[
1
+
]
dip
(euler062)
]
if
]
[
2dup
1
pick
cube
2array
-rot
[
>key
]
dip
set-at
[
1
+
]
dip
(euler062)
]
if
;