Cody

Problem 918. Find the repeating decimal pattern!

Solution 849364

Submitted on 11 Mar 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(repeatingdec(1),'0'))

y = 1

Assertion failed.

2   Fail
assert(isequal(repeatingdec(3/7),'428571'))

y = 0.4285714285714285 str = 428571 rem = 4285

Assertion failed.

3   Pass
assert(isequal(repeatingdec(.3456345612323),''))

y = 0.3456345612323 str = 3456 rem = 12323

4   Pass
assert(isequal(repeatingdec(1/pi),''))

y = 0.3183098861837907 str = 318 rem = 3098861837907

5   Fail
assert(isequal(repeatingdec(1/13),'076923'))

y = 0.07692307692307693 str = 076923 rem = 07693

Assertion failed.

6   Fail
assert(isequal(repeatingdec(2/33),'06'))

y = 0.06060606060606061 str = 06 rem = 1

Assertion failed.

7   Fail
assert(isequal(repeatingdec(.789789789789789789),'789'))

y = 0.7897897897897898 str = 789 rem = 8

Assertion failed.

8   Pass
assert(isequal(repeatingdec(.78978978938383838),''))

y = 0.7897897893838384 str = 789 rem = 3838384

9   Pass
assert(isequal(repeatingdec(1/exp(1)),''))

y = 0.3678794411714423 str = 367879441171442 rem = 3

10   Pass
assert(isequal(repeatingdec(.78787878787833333),''))

y = 0.7878787878783333 str = 78 rem = 3333

11   Pass
assert(isequal(repeatingdec(.123451234512345),'12345'))

y = 0.123451234512345 str = 12345 rem = ''

12   Pass
assert(isequal(repeatingdec(1/100),''))

y = 0.01

13   Pass
assert(isequal(repeatingdec(1/62),''))

y = 0.01612903225806452 str = 016129 rem = 03225806452

14   Pass
assert(isequal(repeatingdec(1/16),''))

y = 0.0625

15   Fail
assert(isequal(repeatingdec(1/91),'010989'))

y = 0.01098901098901099 str = 01 rem = 09890989099

Assertion failed.

16   Fail
assert(isequal(repeatingdec(0),'0'))

y = 0

Assertion failed.