Last active
August 29, 2015 13:56
-
-
Save siddMahen/8835746 to your computer and use it in GitHub Desktop.
Calculate a maximal length 3 progression free subset of [N].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| import math | |
| N = int(argv[1]) | |
| S = set(); | |
| k = N | |
| for j in range(1,N+1): | |
| S.add(j) | |
| while k > 1: | |
| removed = 0 | |
| for i in range(1,int(math.floor(k/2)+1)): | |
| if k - 2*i > 0: | |
| S.remove(k - i) | |
| removed += 1 | |
| k -= removed + 1 | |
| print S | |
| # Experimental results indicate that |S| decreases exponentially | |
| # in N, S ~ 2^kN * N | |
| # | |
| # In relation to http://goo.gl/gnxgQU on the P=NP blog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment