Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rodrigoSaladoAnaya/ca392f593c0b74374641b8b848ce4bc3 to your computer and use it in GitHub Desktop.
Save rodrigoSaladoAnaya/ca392f593c0b74374641b8b848ce4bc3 to your computer and use it in GitHub Desktop.
for(double N = 9; N < 199999; N+=2) {
def U = Math.sqrt((N + Math.sqrt(N - 4)) / 4);
def L = Math.floor(U - 1)
def signature = []
def isOddComNum
double i = 0
for(; i <= L && !isOddComNum; i++) {
def B = (i * 4) + 6;
def Q = (N / B) % 0.5;
isOddComNum = Q == 0
signature << (isOddComNum ? '|' : '.')
}
def index = N.toString().padRight(8)
def tree = signature.join()
if(isOddComNum) {
println "${index} -> ${tree} ${isOddComNum ? '' : 'P'}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment