diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2021-11-11 18:53:24 +0100 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2021-11-11 18:53:24 +0100 |
commit | 8e04f9adc049c2a8281e6d943d5ed26220cedd56 (patch) | |
tree | bf94f294b1da09ba2a85ea4c9a600e2000057aac /problem71.ijs | |
parent | 496ace3ebf6e31ae06577dd8328cadd85f91e896 (diff) |
Problem 71
Diffstat (limited to 'problem71.ijs')
-rw-r--r-- | problem71.ijs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/problem71.ijs b/problem71.ijs new file mode 100644 index 0000000..923cd81 --- /dev/null +++ b/problem71.ijs @@ -0,0 +1,22 @@ +next =: {{%/-:+/2 x:max,y}} +start =: 2r5 +max =: 3r7 + +solve =: {{ + lowBound =. 0 + highBound =. y + guess =. 0 + whilst. guess ~: lastGuess do. + lastGuess =. guess + guess =. <. -: lowBound+highBound + 'num denum' =. 2 x: next^:guess start + if. denum > y do. + highBound =. guess + elseif. denum < y do. + lowBound =. guess + end. + end. + num +}} + +problem71 =: solve 1e6 |