#592 closed Feature Request (Rejected)
a collection of prime based or prime related math functions
| Reported by: | jennico | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | _prime.au3 | Cc: | jennico@… |
Description
;#=#INDEX#==============================================================================================================================#
;# Title .........: _Prime.au3 #
;# Description....: A collection of Prime based and Prime related mathematical operations #
;# Date ..........: 22.9.08 #
;# Author ........: jennico (jennicoattminusonlinedotde) #
;# Functions......: _IsPrime ( $s_number, $s_limit = 32000000 ) #
;# _PrimeNext ( $s_number ) #
;# _PrimePrevious ( $s_number ) #
;# _IsEven ( $s_number ) #
;# _Cross ( $s_number, $s_mode=0 ) #
;# _Factorial ( $s_number ) #
;# _gcd ( $s_number1, $s_number2 = "-", $s_number3 = "-", $s_number4 = "-", $s_number5 = "-" ) #
;# _lcm ( $s_number1, $s_number2 = "-", $s_number3 = "-", $s_number4 = "-", $s_number5 = "-" ) #
;# 1000 ( $x, $s_separator = "" ) #
;# Internal...: Euclid ( $a, $b ) #
;# _ggT ( $s_number1, $s_number2 = "", $s_number3 = "", $s_number4 = "", $s_number5 = "" ) #
;# _kgV ( $s_number1, $s_number2 = "", $s_number3 = "", $s_number4 = "", $s_number5 = "" ) #
;#======================================================================================================================================#
other languages have built in functions like _isprime, _primenext, _primeprevious, _gcd, _lcm, _factorial or _cross, which are very useful for scripting
i scripted very fast implementations of _isprime, _gcd (greatest common divisor) and _lcm(least common multiply)
all functions could be added to math.au3 or even build in.
thanks for your attention
j.
Attachments (1)
Change History (7)
by , on Sep 23, 2008 at 12:56:31 AM
| Attachment: | _prime.zip added |
|---|
comment:1 by , on Sep 23, 2008 at 2:00:12 AM
| Milestone: | Future Release |
|---|---|
| Version: | 3.2.12.0 |
Automatic ticket cleanup.
comment:2 by , on Sep 24, 2008 at 1:24:06 PM
bump
i can guarantee you, you will not find a faster algorithm than my _IsPrime uses. it's very clever.
i bet !
j
comment:3 by , on Sep 24, 2008 at 3:53:54 PM
This is not a forum. You do not need to bump your ticket.
comment:4 by , on Sep 24, 2008 at 6:19:05 PM
at least just a single line, like interesting, not working, awesome or bad would be satisfying. we all just attempt to improve AutoIt.
comment:5 by , on Oct 4, 2008 at 6:23:50 AM
Nitpick... don't use the following:
$s_limit = $s_number / $i
You will get the same optimization by simply initializing $s_limit to the square root of $s_number, but without having to perform a division op with every step of the loop. If you do that, then your test will have to be >= instead of >.
And yes, there is a way to do this even faster, though the sqrt optimization is the fastest you can get without getting too complicated.
comment:6 by , on Oct 30, 2008 at 6:55:44 PM
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
These functions don't seem to be useful on a general scale.

contains _prime.au3 (udf) and _primeexample.au3 (examples)