Show HN: an extremely simple program shows a 2D structure in the integers
This seems unlikely to be a "new" idea, but I stumbled into it by accident and thought it was cool. Java source code below:
// This class is in the public domain.
public class Numbers
{
public static void main(String[] args)
{
int numRows = 256;
int numColumns = 128;
for (int row = 0; row < numRows; row++)
{
StringBuilder rowOutput = new StringBuilder();
for (int column = 0; column < numColumns; column++)
{
if ((row & column) != 0)
rowOutput.append("1");
else
rowOutput.append("0");
}
System.out.println(
String.format("row/col %s:\t%s", row, rowOutput.toString()));
}
}
}
14 comments
[ 3.8 ms ] story [ 36.5 ms ] threadhttp://en.wikipedia.org/wiki/Sierpinski_triangle
I'm sure someone with a greater intuition for mathematics than I have will be able to explain why.
seems to be a paper on this phenomenon, with
http://faculty.msmary.edu/heinold/maa_pres2009-11-14.pdf
being a similar work in presentation form.
I've never seen it before; I like it!
The whole page is a delight, though, and given your enjoyment for your discovery, you'll certainly love browsing it.
In the years since, I've seen primes, rationals, irrationals, Mandelbrot, and all manner of weird structures popping up out of what seemed like nothing.
How did this happen? And who put all that stuff in there?