Created
March 14, 2012 14:10
-
-
Save be5invis/2036719 to your computer and use it in GitHub Desktop.
An solution of Vczh's problem
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
var MakeTest(a0, d): | |
var j = 0; | |
return (x) => | |
def r = a0 + d * j; | |
j += 1; | |
return x === r | |
def guess(test): | |
var counter = 0 | |
for var segment in 1..infinity: | |
for var term in 1...segment: | |
for var mod in 0..term: | |
var testA0 = (segment - term) * term + mod | |
var testD = term | |
if test (counter * testD + testA0): | |
tracel ('found ' + testA0 + ', ' + testD) | |
counter += 1 | |
-- testing | |
guess MakeTest(555, 19) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment