Given this puzzle from Matt Parker, I wrote a swift little shell script to find the solution. 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.
Posts in the Linux Category
Well, I upgraded my laptop to the latest release of Ubuntu, and what can I say? Everything just works. All of the issues I’d identified with 9.10 are no problem with 10.4. Although I should add that this was an upgrade, not a clean install, so it may be the case that my previous fixes [...]
I’ve recently bought an HP G61-401SA Laptop, and installed a dual boot system with Windows 7 and Ubuntu 9.10. I won’t go through the build process, because building a dual-boot system is well documented elsewhere. After installing Ubuntu, most of the laptop features worked fine, the exceptions are listed below.
Here’s a little header file for C/C++ that I knocked up to make colouring console output a little easier. Not all of these colour codes are supported by every console emulator, but if you stick to the primary colours, you should be fine. File: shellColours.h //// Foreground Colours //// #define SH_FG_BLACK "\033[0;30m" #define SH_FG_BLUE [...]
Sometimes, a script which works perfectly fine when run from the shell, fails when run as a cron job. It’s often quite difficult to debug these problems, but to make the task a little easier, try this. Edit the crontab file with crontab -e Add this line for your script (obviously change the script path [...]




















