Darth Paradox (darthparadox) wrote,
Darth Paradox
darthparadox

  • Mood:
  • Music:

Beautiful, beautiful math.

So I'm writing a program that generates a matrix depending on the number you give it. I didn't know what the output would look like when I started, but it turned out beautifully.


Input: 2
Output:
0110
1001
1001
0110

Input: 3
Output:
01101000
10010100
10010010
01100001
10000110
01001001
00101001
00010110

Input: 4
Output:
0110100010000000
1001010001000000
1001001000100000
0110000100010000
1000011000001000
0100100100000100
0010100100000010
0001011000000001
1000000001101000
0100000010010100
0010000010010010
0001000001100001
0000100010000110
0000010001001001
0000001000101001
0000000100010110

Input: 5
Output:
01101000100000001000000000000000
10010100010000000100000000000000
10010010001000000010000000000000
01100001000100000001000000000000
10000110000010000000100000000000
01001001000001000000010000000000
00101001000000100000001000000000
00010110000000010000000100000000
10000000011010000000000010000000
01000000100101000000000001000000
00100000100100100000000000100000
00010000011000010000000000010000
00001000100001100000000000001000
00000100010010010000000000000100
00000010001010010000000000000010
00000001000101100000000000000001
10000000000000000110100010000000
01000000000000001001010001000000
00100000000000001001001000100000
00010000000000000110000100010000
00001000000000001000011000001000
00000100000000000100100100000100
00000010000000000010100100000010
00000001000000000001011000000001
00000000100000001000000001101000
00000000010000000100000010010100
00000000001000000010000010010010
00000000000100000001000001100001
00000000000010000000100010000110
00000000000001000000010001001001
00000000000000100000001000101001
00000000000000010000000100010110

and so on....

it'd be even prettier if the aspect ratios were square.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments