Handbook
Glossary
B ( P Q R S -- n )
Vocabulary
project-euler
.
508
Inputs
P
an
object
Q
an
object
R
an
object
S
an
object
Outputs
n
an
object
Definition
USING:
kernel
math
math.functions
ranges
sequences
;
IN:
project-euler.508
MEMO::
B
( P Q R S -- n )
Q P
-
S R
-
*
5000
<
[
P Q
[a..b]
R S
[a..b]
[
fab
]
cartesian-map
[
sum
]
map-sum
]
[
S 2
/
floor
neg
R 2
/
ceiling
neg
P 2
/
ceiling
Q 2
/
floor
B
S 2
/
floor
neg
R 2
/
ceiling
neg
P 1
-
2
/
ceiling
Q 1
-
2
/
floor
4dup
[
swap
-
1
+
]
2bi@
*
[
B
]
dip
+
S 1
-
2
/
floor
neg
R 1
-
2
/
ceiling
neg
P 2
/
ceiling
Q 2
/
floor
4dup
[
swap
-
1
+
]
2bi@
*
2
*
[
B
]
dip
+
S 1
-
2
/
floor
neg
R 1
-
2
/
ceiling
neg
P 1
+
2
/
ceiling
~16 more~
]
if
;