Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gmp_prob_prime(3) [php man page]

GMP_PROB_PRIME(3)							 1							 GMP_PROB_PRIME(3)

gmp_prob_prime - Check if number is ";probably prime"

SYNOPSIS
int gmp_prob_prime (GMP $a, [int $reps = 10]) DESCRIPTION
The function uses Miller-Rabin's probabilistic test to check if a number is a prime. PARAMETERS
o $a - The number being checked as a prime. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $reps - Reasonable values of $reps vary from 5 to 10 (default being 10); a higher value lowers the probability for a non-prime to pass as a "probable" prime. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. RETURN VALUES
If this function returns 0, $a is definitely not prime. If it returns 1, then $a is "probably" prime. If it returns 2, then $a is surely prime. EXAMPLES
Example #1 gmp_prob_prime(3) example <?php // definitely not a prime echo gmp_prob_prime("6") . " "; // probably a prime echo gmp_prob_prime("1111111111111111111") . " "; // definitely a prime echo gmp_prob_prime("11") . " "; ?> The above example will output: 0 1 2 PHP Documentation Group GMP_PROB_PRIME(3)

Check Out this Related Man Page

GMP_CLRBIT(3)								 1							     GMP_CLRBIT(3)

gmp_clrbit - Clear bit

SYNOPSIS
void gmp_clrbit (GMP $a, int $index) DESCRIPTION
Clears (sets to 0) bit $index in $a. The index starts at 0. PARAMETERS
o $a -Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $index - The index of the bit to clear. Index 0 represents the least significant bit. RETURN VALUES
A GMP number resource in PHP 5.5 and earlier, or a GMP object in PHP 5.6 and later. EXAMPLES
Example #1 gmp_clrbit(3) example <?php $a = gmp_init("0xff"); gmp_clrbit($a, 0); // index starts at 0, least significant bit echo gmp_strval($a) . " "; ?> The above example will output: 254 NOTES
Note Unlike most of the other GMP functions, gmp_clrbit(3) must be called with a GMP resource that already exists (using gmp_init(3) for example). One will not be automatically created. SEE ALSO
gmp_setbit(3), gmp_testbit(3). PHP Documentation Group GMP_CLRBIT(3)
Man Page

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to check variable if its non numeric

if test $b -ne then echo "\n\n\n\tPassword reset has been done successfully" else echo "\n\n\n\tAn error occurred" fi i want to check whether $b is non-numeric so how to do that? (3 Replies)
Discussion started by: sachin.gangadha
3 Replies

2. Shell Programming and Scripting

need the solution

Write a program to print all prime numbers from 1 to 300. (3 Replies)
Discussion started by: paniruddha
3 Replies

3. Shell Programming and Scripting

prime armi con sed e awk

Salve sono alle prime prese con i comandi sed e awk. Nel primo caso vorrei creare uno script in cui viene estratto la partizione maggiore. in pił ci deve essere un messaggio d'avviso se supera l' 80 % dello spazio occupato. Ho pensato di usare il comando df -h, e l' awk. Mi potete dire come?... (1 Reply)
Discussion started by: L_92
1 Replies

4. Programming

Library linking with GMP

I am trying to set up the gnu multiple precision arithmetic library for some c++ programming I have to do. I am using a system with mac osx 10.6.3 and do NOT have root user access. I'm trying to use gmp 5.0.1. Since I don't have root user access, I had to install to a different directory Thus... (3 Replies)
Discussion started by: bluejayek
3 Replies

5. Programming

Anyone wanna write this?

Write a function named isPrime which accepts one integer parameter, say x. Have the function return TRUE if x is a prime. Otherwise, have it return FALSE. b) Write a program that keeps asking the user for an integer say k. As long as k is greater than 0, the program will call... (1 Reply)
Discussion started by: KyleBucket
1 Replies

6. UNIX for Dummies Questions & Answers

How to assign echo in variable

I've testing the following code: echo test.txt | cut -d . -f1and get the output "text" So why can't i assign the command to a variable? VAR='"echo test.txt | cut -d . -f1"' echo $VAR (5 Replies)
Discussion started by: jl487
5 Replies

7. Linux

Difference between Fork and Vfork

Hello Forum members, What is the prime difference between fork and Vfork and when to prefer in our aapications this Vfork. Thanks Siva Ranganath (2 Replies)
Discussion started by: workforsiva
2 Replies

8. Programming

Program wont print prime numbers

The problem I'm having is that when you put in the two numbers the answer is just prime.... nothing. I cannot figure this out ive been working on this forever, can someone please god just tell me how to fix this without encrypted "hints". #include <iostream> #include <cmath> using... (3 Replies)
Discussion started by: c++newb
3 Replies

9. UNIX for Dummies Questions & Answers

Memory allocation problem

I am using ubuntu. I have written a program to calculate prime factors. it works perfectly fine till entered number is less than 9989 (or so ) but when one enters a number higher than that, for example 15000, it does not work. Can anyone guide me whats the problem ? although new codes are welcome,... (2 Replies)
Discussion started by: Abhishek_kumar
2 Replies

10. UNIX for Beginners Questions & Answers

How do I use grep to grab prime number output from my factor program?

I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000. Command: factor/factor 30000000-31000000 Sample output: 30999979 = 30999979 30999980 = 2^2 5 11 140909 30999981 = 3 10333327... (6 Replies)
Discussion started by: steezuschrist96
6 Replies