Shell Script to find Square-Triagular Numbers
Given this puzzle from Matt Parker, I wrote a swift little shell script to find the solution.
1 2 3 4 5 6 7 8 9 | for i in {1..100}; do I=$[i*i] for j in {1..100}; do J=$[(j*(j-1))/2] if [[ $I == $J ]]; then echo $I fi done done |
Not the most efficient solution, but still a fun exercise.