Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Try your attempt with 17 and 19...

I do. Since there aren't enough digits, Math::BigFloat to the rescue:

#!/usr/bin/perl use Math::BigFloat; Math::BigFloat->div_scale(50); my @values = map { my $i = Math::BigFloat->new( 1 ); scalar $i->bdiv( $_ ); } (2,3,6,7,9,11,13,14,17,19,23); for (@values) { /\.\d*?(\d+?)\1/; print "$_: $1\n" } __END__ 0.5: 0.33333333333333333333333333333333333333333333333333: 3 0.16666666666666666666666666666666666666666666666667: 6 0.14285714285714285714285714285714285714285714285714: 142857 0.11111111111111111111111111111111111111111111111111: 1 0.090909090909090909090909090909090909090909090909091: 09 0.076923076923076923076923076923076923076923076923077: 076923 0.071428571428571428571428571428571428571428571428571: 714285 0.058823529411764705882352941176470588235294117647059: 058823529411764 +7 0.052631578947368421052631578947368421052631578947368: 052631578947368 +421 0.043478260869565217391304347826086956521739130434783: 043478260869565 +2173913

The regex is the same, though. Still missing something?

update: Oh, I see. "try with 170..." :-)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re^3: Recurring Cycle of Fractions by shmem
in thread Recurring Cycle of Fractions by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (8)
    As of 2014-09-16 10:16 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (4 votes), past polls