Live data from Hacker News

Show HN: an extremely simple program shows a 2D structure in the integers

news.ycombinator.com

1–10 of 15 posts

Show HN: an extremely simple program shows a 2D structure in the integers

#1
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 

Re: Show HN: an extremely simple program shows a 2D structure in the integers

#5

Reminds me of Sierpinski triangles: http://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.

My first thought is that it has something to do with the fact that you get a Sierpenski Triangle from a Pascal's triangle when you assign one color to even numbers and another to odd: http://en.wikipedia.org/wiki/Pascal%27s_triangle#Overall_pat...

Re: Show HN: an extremely simple program shows a 2D structure in the integers

#7
Here's a C version in less than 80 characters:

  main(c,r){for(r=32;r;)printf(++c>31?c=!r--,"\n":c
I first learned of this phenomenon in my discrete math class, and we had a competition to see who would write the shortest program to draw a Sierpinski triangle. This version would certainly have won if I'd been clever enough to write it at the time, though even shorter versions are possible in other languages.

Re: Show HN: an extremely simple program shows a 2D structure in the integers

#8
This was on HN a couple of days ago:

  http://www.oftenpaper.net/sierpinski.htm
It points out that you can interpret the table as the relation "is disjoint" between the bitsets encoded in the row and col indices (CTRL+F for "binary logic"). Following links from there will take you to a rabbit hole of combinatorics that I will not claim to fully understand.

The whole page is a delight, though, and given your enjoyment for your discovery, you'll certainly love browsing it.

Re: Show HN: an extremely simple program shows a 2D structure in the integers

#9
post #5

Reminds me of Sierpinski triangles: http://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.

My first thought is that it has something to do with the fact that you get a Sierpenski Triangle from a Pascal's triangle when you assign one color to even numbers and another to odd: http://en.wikipedia.org/wiki/Pascal%27s_triangle#Overall_pat...

[deleted]
Post reply on HN