Skip to content

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

Comments

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

  main(c,r){for(r=32;r;)printf(++c>31?c=!r--,"\n":c<r?" ":~c&r?" `":" #");}
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.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.