Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Guess automorphic number by matching the 1's place in integers... */
- Number.prototype.isAutomorphic = function(){
- var sq = (this * this).toString(), selfstr = this.toString();
- return (sq.charAt(sq.length - 1) == selfstr.charAt(selfstr.length - 1));
- }
- /* implementation */
- var t = 5;
- alert("t automorphic? " + t.isAutomorphic().toString());
Advertisement
Add Comment
Please, Sign In to add comment