Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Looks like we may need benchmark for this game. Here is the answer, I'll post the complete code in 24 hours so as not to spoil all the fun. It's ~ 30 average lines long and runs under strict. I have included the begining and end. My woodwork teacher used to say look after the edges and the middle will look after itself..... BTW Please enter perlmonks for the prize and donate it to the offering plate when we win!

Hint:

There is only one solution,

brute force is not the key

With code in evolution,

consider the holy three

 

tachyon

one 435 three 17955 six 820 ten 153 Elapsed 0 seconds #!/usr/bin/perl -w use strict; my $time = time(); my %tri; # make hash of tiangular numbers 5 digits or less map{$tri{.5*$_*($_+1)}=1}1..446; ... ... # prove we are right! print "one $o$n$e " if defined $tri{"$o$n$e"}; print "three $t$h$r$e$e " if defined $tri{"$t$h$r$e$e"}; print "six $s$i$x " if defined $tri{"$s$i$x"}; print "ten $t$e$n\n" if defined $tri{"$t$e$n"}; $time = time()-$time; print "Elapsed $time seconds\n";

In reply to Re: (Efficiency Golf) Triangular numbers by tachyon
in thread (Efficiency Golf) Triangular numbers by jepri

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: (9)
    As of 2014-07-14 08:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (257 votes), past polls