Type::Prime -- a type and a
property representing prime numbers
IntroductionType::Prime represents prime numbers.
Type::Prime is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::Prime)
assume(x, Type::Prime)
is(ex, Type::Prime)
Parametersobj |
- | any MuPAD object |
x |
- | an identifier or one of the expressions Re(u) or Im(u) with an identifier
u |
ex |
- | an arithmetical expression |
Returns
Related
Functionstesttype, is, assume, isprime, Type::Property
Detailstesttype(obj, Type::Prime) checks,
whether obj is a prime number and returns TRUE, if it holds, otherwise FALSE.testtype only
performs a syntactical test identifying MuPAD objects of type
DOM_INT and checks, if
isprime(obj)
holds.assume(x,
Type::Prime) marks the identifier x as a prime number.
The call is(ex,
Type::Prime) derives, whether the expression ex is a prime
number (or this property can be derived).
assume and is.
Example
1The following numbers are of type
Type::Prime:
>> testtype(2, Type::Prime), testtype(3, Type::Prime), testtype(7, Type::Prime), testtype(11113, Type::Prime), testtype(4185296581467695597, Type::Prime)
TRUE, TRUE, TRUE, TRUE, TRUE
Example
2Assume an identifier is prime:
>> assume(x, Type::Prime): is(x, Type::Prime)
TRUE
Also prime numbers are integers:
>> assume(x, Type::Prime): is(x, Type::Integer)
TRUE
However, integer numbers can be prime or not:
>> assume(x, Type::Integer): is(x, Type::Prime)
UNKNOWN
>> delete x: