A small, comfortable nook pertaining to technology, current events, astronomy, and sailing and navigation.

Wednesday, February 13, 2008

Quick Powers Of Two Table

Here's a quick and dirty method of generating a table of powers of two at the command line:
#!/bin/bash

echo "Powers of two (2):"
echo;
for i in `seq 0 34`; do
printf "2**(%2d) = %11d\n" $i "$(( 2**$i ))"
done
echo;
Note that this does require BASH.

No comments: