lychrel
test for Lychrel numbers
isPalindrome(val)
Checks if a number/string is a palindrome
- @param {String/Number}
val
- @return {Boolean}
; ; // true; // true; // false
reverseAndAdd(val)
Reverses the digits in a number and adds it to the original
- @param {Number}
val
- @return {Number}
; ; // 55; // 444
isLychrel(val, maxIterations)
Attempts to determine if a number is a Lychrel number. Quits after max iterations.
- @param {Number}
val
- @param {Number}
[maxIterations = 100]
- @return {Object}
- {Boolean/undefined} isLychrel - false if disproven, undefined if indeterminate before max iterations
- {Number} lastValue - last calculated value
- {Number} iterations
; ;// {// isLychrel: false,// lastValue: 8813200023188,// iterations: 24,// } ;// {// isLychrel: undefined,// lastValue: 820255645655561900,// iterations: 100,// } ;// {// isLychrel: undefined,// lastValue: 3417785356534986000,// iterations: 200,// }
kickstarted by npm-boom