Today I resolved this kata on Shell and I'm thirteenth... :)
Oooooh!!!
It is rather difficult task for Shell/Bash.
The key stone is Perfomance!!!
One day for writing code and one week for it's optimisation.
For success it is necessary to understand math theory:
square properties,
division algorithms,
factorization,
square root properties and finding algorithms,
prime numbers.
Carefull reading articles on Wikipedia will be enought.
Also Shell things like: loops, logical conditions, arithmetic module and a lot of small but important nuances. For example ((i+=1)) faster then i=$((i+1))
For optimisation very helpful Math theory and understanding how Shell works - avoiding sub-shell inside loops, pipes and non-builtin programs - their are make code slower.
Even after several years of expirience I discovered a lot of new things for me, like custom PS4 and 'factor'.
P.S. Author, thank You for this kata. Sometimes during deeep optimisation I was hated You! :) but finally I'm thankful! :))
Today I resolved this kata on Shell and I'm thirteenth... :)
Oooooh!!!
It is rather difficult task for Shell/Bash.
The key stone is Perfomance!!!
One day for writing code and one week for it's optimisation.
For success it is necessary to understand math theory:
Carefull reading articles on Wikipedia will be enought.
Also Shell things like: loops, logical conditions, arithmetic module and a lot of small but important nuances. For example
((i+=1))
faster theni=$((i+1))
For optimisation very helpful Math theory and understanding how Shell works - avoiding sub-shell inside loops, pipes and non-builtin programs - their are make code slower.
Even after several years of expirience I discovered a lot of new things for me, like custom PS4 and 'factor'.
P.S. Author, thank You for this kata. Sometimes during deeep optimisation I was hated You! :) but finally I'm thankful! :))