Question: Repeating sequence of decimal

(Some) prime reciprocals have an interesting property. the repeating sequence has length p-1.

eg 7, has repeats after 6.

1/7=0.142857142857......

17 has repeats after 16

1/17=0.05882352941176470588235294117647059.........

of course some primes don''t have this property....

So what I need the experts here is for some code

myproc(17)=16, (and the sequence) 0588235294117647

my go:pinched from

http://199.71.183.11/questions/39621-Pattern-Matching-In-A-Sequence-Of-Digits

PriDigits := "" || (op(1, evalf(1/17, 50)));

reps := StringTools[Repeats](PriDigits);

lngth := seq(op(3, A), A in [reps]);

the leading 0 (which is part of the sequence)  is a problem.....

 

 

Please Wait...