diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2021-11-10 19:17:01 +0100 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2021-11-10 19:17:01 +0100 |
commit | cfc4bd0e35f79d0e42c3e66fe8fc67d98046d0a5 (patch) | |
tree | 11e98c514490bd94512d4440005811d4f8fd09b4 | |
parent | a6c6adcd0736a91a4b95ca3974a3a8f34b379fc6 (diff) |
Problem 751
-rw-r--r-- | problem751.ijs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/problem751.ijs b/problem751.ijs new file mode 100644 index 0000000..89d3450 --- /dev/null +++ b/problem751.ijs @@ -0,0 +1,20 @@ +digits =: 24 +next =: {{ (<.y)*1+y-<.y }} +catseq =: {{ (([: ".'x',~]) % 10x^<:@#) (digits+1){.;":each<.y }} +digitsOf =: {{ <. y * 10^x:x }} +solve =: {{ + lowerBound =. x:2.0 + upperBound =. x:2.9 + whilst. (digits digitsOf res) ~: (digits digitsOf start) do. + start =. -: lowerBound + upperBound + res =. catseq <. next^:(i.digits+1) start + if. res < start do. + upperBound =. start + elseif. res > start do. + lowerBound =. start + end. + end. + start +}} + +problem751 =: ({.,'.',}.)": digits digitsOf solve ''
\ No newline at end of file |