Skip to content

Instantly share code, notes, and snippets.

@Fohlen
Created May 19, 2016 12:07
Show Gist options
  • Save Fohlen/f8f2146a760bbaf6b3b3617aad184b86 to your computer and use it in GitHub Desktop.
Save Fohlen/f8f2146a760bbaf6b3b3617aad184b86 to your computer and use it in GitHub Desktop.
Calculate the amount of rows in a borderless square (x/y angles) to draw a triangle
function sequence2D(n) {
if (n > 1) {
return this.sequence2D(n - 1) + (n + 1);
} else if (n == 1) {
return 3;
} else {
throw new RangeError("A sequence operates on real numbers.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment