Fermat pseudoprime/Code: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Karsten Meyer
(New page: The following Sourcecode is the Heart of all calculating fermat pseudoprime-, euler pseudoprime- aund strong pseudoprime programs: <code> →‎REXX-Programm: say 'Only a Library!' exit...)
 
imported>Karsten Meyer
m (typo)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The following Sourcecode is the Heart of all calculating fermat pseudoprime-, euler pseudoprime- aund strong pseudoprime programs:
{{subpages}}
The following Sourcecode is the Heart of all calculating fermat pseudoprime-, euler pseudoprime- and strong pseudoprime programs:


<code>
<code>

Latest revision as of 04:14, 6 January 2008

This article is developing and not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
Code [?]
 
A collection of code samples relating to the topic of Fermat pseudoprime.

The following Sourcecode is the Heart of all calculating fermat pseudoprime-, euler pseudoprime- and strong pseudoprime programs:

/* REXX-Programm */
say 'Only a Library!'
exit 1
/* */
/* */
m_u: procedure
  arg a,l,m
/* initialisierung */
  as = a
  ai = a
  li = (l-1)
  DO li
    a = a * ai
    a = a // m
  END
return a

mod_up.r

A sourcecode to calculate fermat pseudoprimes

/* Ein REXX-Programm */

call load 'mod_up.r'
anzfpspr=0
do i = 2 to 99999
  fpsprb.i = " "
  t=0
  t2=0
  do i2 = 2 to (i-2)
    call m_u i2, (i-1), i
    pt = result
    if (pt = 1) then do
                        t = 1
                        fpsprb.i2 = fpsprb.i2||i||", "
    end
    if (pt > 1) then t2 = 1
  end
  tg = t + t2
  if (tg = 2) then do
                     anzfpspr = anzfpspr + 1
                     ausgabe = "fpspr."||anzfpspr||" = "||i
                     say ausgabe
                     lineout("epspr_var.txt",ausgabe)
  end
end
lineout("fpsprb_table2.txt","{| {{prettytable}")
do i = 2 to 99999
  ausgabe = "|"||i||" ||"||fpsprb.i||"@"
  say ausgabe
  lineout("fpsprb_table2.txt",ausgabe)
  lineout("fpsprb_table2.txt","|-")
end

The File "epspr_var.txt" is used to calculate euler pseudoprimes. The file "fpsprb_table2.txt" is a table in Wikimedia format.