Re: Prime numbers
To compute whether a number is a prime number, my script:
1. Tests if even or multiple of five, if true then not prime,
2. Tests for factors, if true then not prime, by:
i. Halving, because factors are less than half, then for every
possible factor:
i.a. Testing if that number is even or multiple of five, if true then
not prime,
i.b. Testing if that number leaves no remainder when divisor of
original number, if true then not prime,
Else the number is prime.
Does anyone know of a more efficient method?
Jerome K Maule McKean
On 03/04/2005 03:01, Mr. J. K M. McKean wrote:
https://dreamfrequency.com/primes.html
Optimised code, giving large speed improvement.
Jerome K Maule McKean
On 27/03/2005 19:25, Mr. J. K M. McKean wrote:
Calculates all the prime numbers below a number.
https://dreamfrequency.com/primes.html
Jerome K Maule McKean
.
Relevant Pages
- Re: One other related Q Re: basic Q: Only one way to make vars live outside of the scope of a functi
... >>> directly to the calling script, without having to use global variables ... to get multiple return items from a subprocedure. ... >>> better not to mix scope and use global variables for multiple return ... before terminating the object reference. ... (microsoft.public.scripting.vbscript) - Re: Can you have a command line arg with a workbook?
... "Patrick Molloy" wrote: ... but I guess I would still need the multiple IF statements (or ... Case if that works in VBScript?) ... this script starts a new instance of Excel. ... (microsoft.public.excel.programming) - Re: Pattern for foo tool <-> API <-> shell|GUI
... The user can execute a Python script in the shell, ... There are multiple command ... where the command-line handler might look something like:: ... documentation of generate-- and any other methods that accept handler ... (comp.lang.python) - Re: shell script
... |> i need a shell script that can create multiple users.... ... If you setup 1000 users with this, and I want to steal some accounts, all I need to do is login to my account, cat /etc/passwd then login to some of the other accounts that have yet to be 'activated' and change the passwords myself. ... You could probably write a wrapper script or a script to generate /etc/shadow and /etc/passwd entries and depending on how you wanted your users grouped, /etc/group entries as well and then create thir home directory, chown it to the newly created user and copy the contents of /etc/skel to the new home directory, chowning it in the process. ... (RedHat) - Re: USB microscopes for very small SMT
... multiple copies of all your tools? ... I was somewhere and needed a file, a script actually, and it was on ... Just used the GPRS modem to connect to my home server, ... (sci.electronics.design) |
|