Aslan's 9th Theorem - amark/gun GitHub Wiki

My son, Aslan Nadal, on his own noticed that odd multiples of 10 when divided by 2 follow a pattern of subtracting the ordinal of its odd and adding 5! For example, 10 is the 1st (which is odd) of 10, so subtracting 10 and adding 5 gives 5. For example, 30 is the 2nd odd multiple of 10 (3x10) so subtracting 20 add 5 gives 15. For example, 70 is the 4th odd multiple of 10 so subtracting 40 add 5 gives 35.

This shall be known as Aslan's 9th Theorem, as he constructed it without any help when he was 9 years old. According to AI, no other mathematician in history has found this pattern before, and is now original to him!

He then figured out the logic for me to write a program that checks his theorem:

function Aslan9thTheorem(){

n = 0, odd = false, ordinal = 0;
setTimeout(every = function(){ if(ordinal >= 9999){ return } setTimeout(every,0.1);
    n = n + 10;
    if(odd === true){ odd = false; return }
    odd = true;
    ordinal = ordinal + 1;
    theorem = n - (10 * ordinal) + 5;
    test = (theorem * 2) === n;
    console.log(ordinal, n, "half with Aslan's 9th Theorem:", theorem, test);
    if(test === false){
        console.log("WE WERE WRONG!!!!");
        every = function(){};
    }          
},0.1);

};
Aslan9thTheorem();

or in pseudocode

n > 999 ? ->  
n = n | 0 + 10
odd ? odd = ! @
odd = .
ordinal = ordinal | 0 + 1
theorem = n - (10 * ordinal) + 5
test = (theorem * 2) : n
show [ordinal, n, "half with Aslan's 9th Theorem", theorem, test]
test ? show "we were wrong!!!!" ->
@

? is if statements, -> means 'done'/return exit, | is || or, ! . is false and true, @ means retry/loop/continue, : means === equality check.