Skip to content

Instantly share code, notes, and snippets.

@PPartisan
Created December 28, 2015 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PPartisan/6169bb9cf4794304b901 to your computer and use it in GitHub Desktop.
Save PPartisan/6169bb9cf4794304b901 to your computer and use it in GitHub Desktop.
Short method for determining whether input is a triangular number
public static boolean isTriangularNumber(int number) {
return (((Math.sqrt((8*number)+1)) % 1) == 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment