The tests are inconsistent with the statement of the problem. Finite strings like ..123451234512345 only repeat to the end of the string, then switch to zeros.
If the number is a true repeater, then multiplying it by 999... for some number of 9's will result in an integer. The difficulty lies in the rounding. I had to tune the tolerance to deal with cases like .123451234512345, which aren't truly repeating.
Some cleaning up!
Test if a Number is a Palindrome without using any String Operations
Construct a string from letters and counts
Convert hex color specification to MATLAB RGB
Spot the outlier
Generate N equally spaced intervals between -L and L
Spiraling out of control....
What are the odds?
Return the Fibonacci Sequence
Circle and Quadratic
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office