I don't understand something in your logic/description. It seems to be a minor "typo" type thing, but I'm not sure which statement is correct:

First you said:

"I expected to get 5/2 for n = 2 and 13/3 for n = 3, etc."

But then you said that:

n = 2, sum = 1 n = 3, sum = 5/2
was correct. Did you want "n=2 to equal 1" or "n=2 to equal 5/2"? (though I can't see how this would mangle the output like it does. I haven't quite figured that part out...*grumble*...:-).

But I sorta mentally ran the 1st loop for n=1. That starts with the inner loop being

"for my $k (1 .. 0) {"
which isn't horrible by itself, but certainly isn't what I'd expect for a 1st iteration of your series:
"Sumof(Num/Denom) for Num=(1..n) and Denom='(n..1)'[=>'n+1-Num']"

In reply to Re: issues using bigrat by perl-diddler
in thread issues using bigrat by pc88mxer

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.