f::prime_p (public)

 f::prime_p n

Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl

Parameters:
n
Returns:
1 if n is prime

Partial Call Graph (max 5 caller/called nodes):
%3 f::even_p f::even_p (public) f::prime_p f::prime_p f::prime_p->f::even_p

Testcases:
No testcase defined.
Source code:
    if { $n<2 } { return 0 }
    if { $n==2 } { return 1 }
    if { [even_p $n] } { return 0 }
    for {set i 3} {$i*$i<=$n} {incr i 2} {
        if { $n%$i==0 } { return 0 }
    }
    return 1
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: