Greetings Monks, The following is a script for generating prime numbers. I hope that it works because at this point all of my hardware, except my trusty T1200 text processor is down. This is a terrible situation because my perl skills are rusting. None the less, I have uploaded this at a public access terminal and if any monk cares to email the output to neutrin0@cyberspace.org I would be inspired. Further more, I am curious about the nature of the range operator. I have utilized it's two incarnations in the following:
#! /usr/bin/perl use Math::BigInt ':constant'; my $i; my $target; my $flta; my $fltb; my $base; my $exp; my $i=1; for $target(1...560){ flt($target); print "$target is prime number $i"; if ($i==560){print "From $target and greater are the appearance of Car +michael numbers,other primality tests are required.";} sub flt{ $target=shift @_; $exp=$target -1; PRIMALITY: for $base(1..$exp){ $flta=$base**$exp; $fltb=$flta%$target; if ($fltb==1){ next PRIMALITY; }else{ last} $i=$i+1; return $target; }

Retitled by davido from 'Primality'.


In reply to Prime number generation, and range operator by dReKurCe

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.