"Daily Study", "high-precision fast power" codevs1087 Mason number

Source: Internet
Author: User

Title Description Description

shape 2p -1 is a prime number called Mason, when p must also be a prime number. But not necessarily, that is, if p is a prime number, 2p -1 is not necessarily a prime number. To 1998 at the end of the year, people have found 37 number of Mason. The biggest one is p=3021377 , it has

Task: Enter p(1000<p<3100000) from the file to calculate the number of digits of 2p-1 and the last Digits (expressed in decimal high-precision number)

Enter a description input Description

Only one integer P(1000<p<3100000) is included in the file

outputs description output Description

First line: Decimal high precision number 2P-1 digits.

Line 2-11 : The last digit of the decimal high precision number 2P-1 . (output of each line, a total of ten lines, less than 0high-level complement)

You do not have to verify that 2p-1 and p are prime numbers.

sample input to sample

1279

Sample output Sample outputs

386

00000000000000000000000000000000000000000000000000

00000000000000000000000000000000000000000000000000

00000000000000104079321946643990819252403273640855

38615262247266704805319112350403608059673360298012

23944173232418484242161395428100779138356624832346

49081399066056773207629241295093892203457731833496

61583550472959420547689811211693677147548478866962

50138443826029173234888531116082853841658502825560

46662248318909188018470682222031405210266984354887

32958028878050869736186900714720710555703168729087

It's obvious that a naked, fast-power-high-precision first-time write, either process or output, has encountered a lot of problems. Thank you, Leo God Ben

In particular, it is important to note that the array replicates the transfer of one-dimensional arrays

Time is pressing, just write the code.


--The wild cry of thousands of smell war cutting, Yi song several places fishing firewood


Copyright NOTICE: Reprint Please specify source [ametake Copyright]http://blog.csdn.net/ametake Welcome to see

"Daily Study", "high-precision fast power" codevs1087 Mason number

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.