| Download
All published worksheets from http://sagenb.org
Project: sagenb.org published worksheets
Views: 168730Image: ubuntu2004
File: /usr/local/sage2/local/lib/python2.6/site-packages/sage/rings/arith.py
Type: <type ‘function’>
Definition: is_prime(n)
Docstring:
Returns True if n is prime, and False otherwise.
AUTHORS:
- Kevin Stueve kstueve@uw.edu (2010-01-17): delegated calculation to n.is_prime()
INPUT:
- n - the object for which to determine primality
OUTPUT:
- bool - True or False
EXAMPLES:
sage: is_prime(389) True sage: is_prime(2000) False sage: is_prime(2) True sage: is_prime(-1) False sage: factor(-6) -1 * 2 * 3 sage: is_prime(1) False sage: is_prime(-2) FalseALGORITHM:
Calculation is delegated to the n.is_prime() method, or in special cases (e.g., Python int``s) to ``Integer(n).is_prime(). If an n.is_prime() method is not available, it otherwise raises a TypeError.
False
139
File: /tmp/tmpYyP2xw/___code___.py
Type: <type 'function'>
Definition: example1(num1, num2)
Docstring:
Returns the product of the numbers
435
1 1 2 3 5 8 13 21
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610
106
45
3
10
11
94
False
139
False
11
6007
False
True
x = True y= False
True
False
True
True
False
True