Rabin-miller algorithm

Source: Internet
Author: User
Tags cas

"Title description"

Rabin-miller algorithm.

"Input description"

First line: CAs, representing the number of data groups (CAS <= 350), the following CAS lines, one number per line, guaranteed to be within a 64-bit long shaping range, and no negative numbers. You need for each number:

First, test whether it is prime, prime
Second, if it is not prime, which number is the maximum quality factor of the output.

"Output description"

The first line of CAS (CAS <= 350, which represents the number of groups of test data).
The following CAS lines: one digit per line, guaranteed to be a positive number within the 64-bit long shaping range.
For each set of test data: The output prime, which represents it as a prime number, or the output of its largest mass factor, represents it as number and number.

"Input Sample"

6
2
13
134
8897
1234567654321
1000000000000

"Output Example"

Prime
Prime
67
41
4649
5

"Data range and Tips"
Guarantee CAs <= 350 to ensure that all numbers are within the 64-bit long range.

Rabin-miller algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.