I down voted this post last night when you posted the first three lines of the current post:

We are talking about integer factorisation?

This has (almost) nothing to do with integer factorisation. That is to say, whilst there might be an approach the problem using integer factorisation; it would be like using calculus to tally your bar bill.

Can't be calculated without a quantum computer.

Whilst generalised integer factorisation is known to be hard; for the size of integers involved here < 2^64, there are simple, efficient methods available.

Plus your code could endless loop

You're right, it could; but only if the product, $r *4096 > $c; which will never be the case; and the 'cure' (omitted for clarity in the description of the question) is trivial.

So now we come to your belatedendum:

One good solution is to use a lookup table.

(Apart from: what does $__intfactor{%r} mean?, (which I'll assume is a typo); and where did $r and $c come from in that subroutine? (Which I'll assume is just laziness.)

Offering a solution that caches to disk, the results of the iterative method I posted, doesn't begin to answer the question I asked.

It's like answering the question "How do we solve world hunger", with a proposal for setting up food warehouses and suggesting that when people are hungry, they simply go to the warehouse and collect some food.

Finally

This is the third time in the last couple of days where you've immediately posted something fairly meaningless when a SoPW first appears; and then silently expanded/modified it without attribution later. Apparently taking Ambrus' "advice" to heart.

Fair warning: Continue to do so in threads I start, or those I am interested in, and you and I will have a problem.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

In reply to Re^2: Simple arithmetic? by BrowserUk
in thread Simple arithmetic? by BrowserUk

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.