Created
December 28, 2015 22:13
-
-
Save PPartisan/6169bb9cf4794304b901 to your computer and use it in GitHub Desktop.
Short method for determining whether input is a triangular number
This file contains 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
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