diff options
-rw-r--r-- | problem47.ijs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/problem47.ijs b/problem47.ijs new file mode 100644 index 0000000..fb483ab --- /dev/null +++ b/problem47.ijs @@ -0,0 +1,21 @@ +factors =: verb : '*/__ q:y' +distinctFactors =: verb : '#~.;factors each y' + +n =: 2 +count =: n*n + +solve =: verb define + n =. y + count =. n*n + i =. 1 + result =. 0 + while. result = 0 do. + if. count = distinctFactors i+i.n do. + result =. i + end. + i =. i + 1 + end. + result +) + +problem47 =: solve 4
\ No newline at end of file |