Nice Prime!

June 21st, 2012 | Categories: general math, mathematica | Tags:

In a recent tweet, Cliff Pickover told the world that 
7272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727­27272727 is prime. That’s a nice looking prime and it took my laptop 1/100th of a second to confirm using Mathematica 8.

PrimeQ[727272727272727272727272727272727272727272727272727272727272727\
272727272727272727272727272727272727] // AbsoluteTiming

Out[1]= {0.0100000, True}

Can anyone else suggest some nice looking primes?

  1. Michael
    June 21st, 2012 at 20:25
    Reply | Quote | #1

    Unfortunately, Mathematica isn’t able to tell me what value of x for Prime[x] will yield that number. (And why aren’t Prime and PrimePi parallelizable, anyway??) It would be awesome if that value was also a neat looking prime.

  2. June 21st, 2012 at 21:38
    Reply | Quote | #2

    Is 135791113151719212325272931333537394143454749515355575961636567697173757779818385878991939597 nice enough? The interesting thing is that four nontrivial prefixes of it are also primes. (I used isprime(parse(cat(“”, seq(1 .. 97, 2)))) to verify its primality in Maple by the way.)

  3. June 21st, 2012 at 21:51
    Reply | Quote | #3

    Also, 1003005007009011013015017019021023025027029031033035037039041043045047049051053055057059061063065067069071073075077079081083085087089091093095097099101103105107109111113115117119121123125127129131133135137139141143145147149151153155157159161163165167169171, obtainable as parse(cat(seq(sprintf(“%03d”, i), i=1..171, 2))).

  4. Simon
    June 21st, 2012 at 22:06
    Reply | Quote | #4

    There appears to be a serious base 10 bias in this blog post and comments. Does it mean anything for a prime to be “nice looking” outside of a particular base?

  5. June 21st, 2012 at 22:06
    Reply | Quote | #5

    Yep, they are definitely nice enough! pretty amazing that we can check primality of such large numbers so quickly.

    Thanks!

  6. June 21st, 2012 at 22:42
    Reply | Quote | #6

    @simon..it’s a good point, we are all being very baseist

  7. Martin Cohen
    June 22nd, 2012 at 00:38
    Reply | Quote | #7

    Are these verifications absolute or probabilistic?

  8. Thales Fernandes
    June 22nd, 2012 at 03:02
    Reply | Quote | #8

    All Primes… :)

    7

    727

    72727

    727272727

    72727272727272727

    72727272727272727272727272727272727272727272727272727272727272727272727

    727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727

    727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727

  9. Thales Fernandes
    June 22nd, 2012 at 03:05
    Reply | Quote | #9

    1 and 7 are cool too.

    1717171717171717171717171717171

    1717171717171717171717171717171717171

  10. Thales Fernandes
    June 22nd, 2012 at 03:06

    Why not use only 1 and 7?

    1717171717171717171717171717171

    1717171717171717171717171717171717171

  11. Thales Fernandes
    June 22nd, 2012 at 03:10

    3 and 7;

    373

    373737373737373737373

    373737373737373737373737373

    373737373737373737373737373737373737373737373737373737373737373737373737373737373

    …..

    and with 1893 numbers

    373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373

  12. Thales Fernandes
    June 22nd, 2012 at 03:16

    9 and 7

    997

    99797979797979797979797979797979797979797979797979797979797

    997979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797

    99797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797979797

    I’m a math prime spammer? Sorry :( I’m ashamed…

  13. Thales Fernandes
    June 22nd, 2012 at 03:17

    This is even more improbable! 7 and 8! 4 times better than 7 and 2!

    78787

    787878787878787878787

    787878787878787878787878787

    78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787

  14. June 22nd, 2012 at 07:09

    @Thales I think we are going to have to come up with a compact notation. On my browser, these numbers scroll right outside the boundaries of the box

  15. June 22nd, 2012 at 07:19

    @Martin
    According to http://reference.wolfram.com/mathematica/tutorial/SomeNotesOnInternalImplementation.html#6849

    ‘PrimeQ first tests for divisibility using small primes, then uses the Miller-Rabin strong pseudoprime test base 2 and base 3, and then uses a Lucas test.’

    It’s a probabilistic procedure. More details at http://mathworld.wolfram.com/Rabin-MillerStrongPseudoprimeTest.html

  16. Martin Klauco
    June 22nd, 2012 at 09:13

    Poor MATLAB, cannot handle such huge number :(… though I don’t understand why.

    —–
    Core i5, RAM 4GB, MATLAB R2012a 64bit

  17. June 22nd, 2012 at 11:27

    Hi Martin

    If you are using plain MATLAB then it will be because MATLAB is using hardware-based double precision arithmetic and such a huge number cannot be exactly represented in it.

    What you need to do is use the symbolic toolbox. Launch the mupad interface by typing

    mupad

    at the MATLAB prompt. Then, in the Mupad notebook, evaluate

    isprime(N)

    Replacing N with whatever huge integer you want to check. Mupad uses a very similar prime checking algorithm to Mathematica so the result is probabilistic (i.e., there is a chance it’s wrong!) as mentioned in a comment above.

    Cheers,
    Mike

  18. Thales Fernandes
    June 22nd, 2012 at 17:06

    @Mike Yeah… full notation is better since it gives the impression of “longness”. But anyway, a new notation.

    Define a number in the form abbbb…bb where “a” and “b” are blocks of integers, and there are “n” blocks “b”‘s.

    For a=7 and b=27, the numbers are prime for the following n’s:
    n=1, 2, 4, 8, 35, 49, 121
    For a=3 and b=73, the numbers are prime for the following n’s:
    n=1, 10, 13, 40, 157, 424
    For a=7 and b=87, the numbers are prime for the following n’s:
    n=1, 2, 10, 13, 47

    For a=1 and b=23456789, the numbers are prime for the following n’s:
    n=59
    For a=1 and b=87654321, the numbers are prime for the following n’s:
    n=6, 49, 138

    Yay! For more primes use the function:
    RepeatedPrime[headN_, repeated_, n_Integer] := FromDigits@Flatten@{headN, ConstantArray[repeated, {n}]}

  19. Martin Klauco
    June 24th, 2012 at 20:25

    Hi Mike,

    thanks for the suggestion, that “mupad” command is quite useful for me!

    Martin

  20. July 4th, 2012 at 10:25

    Here is a quick brute-force search of two digit repeaters…

    RepeatingDigits[n_, c_] :=
    ToExpression[
    Apply[StringJoin, Table[ToString[n], {c}]]
    StringTake[ToString[n], 1]]
    Do[If[PrimeQ[#], Print[#]] &[RepeatingDigits[n, c]], {n, 10, 99}, {c,
    20, 80}]

    1212121212121212121212121212121212121212121

    1212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121

    151515151515151515151515151515151515151515151515151515151515151

    15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151

    1616161616161616161616161616161616161616161616161616161

    1616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161

    1616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161

    18181818181818181818181818181818181818181818181818181818181818181818181818181

    1919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191

    313131313131313131313131313131313131313131313131313

    31313131313131313131313131313131313131313131313131313131313131313131313131313131313

    373737373737373737373737373737373737373737373737373737373737373737373737373737373

    383838383838383838383838383838383838383838383838383838383

    72727272727272727272727272727272727272727272727272727272727272727272727

    727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727

    75757575757575757575757575757575757575757575757575757575757575757575757575757

    75757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757

    75757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757575757

    78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787

    94949494949494949494949494949494949494949494949494949494949494949

    94949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949494949

    979797979797979797979797979797979797979797979

    98989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989898989

  21. July 4th, 2012 at 10:29

    Oops. The blog comment system stripped out the StringJoin characters. Code again in different format…

    RepeatingDigits[n_, c_] := ToExpression[ StringJoin[Apply[StringJoin , Table[ToString[n], {c}]], StringTake[ToString[n], 1]]];
    Do[If[PrimeQ[#], Print[#]] & [RepeatingDigits[n, c]], {n, 10,
    99}, {c, 20, 80}]

  22. July 10th, 2012 at 22:12

    Another nice series are the “decimal repunit primes”, like 11, 1111111111111111111, and 11111111111111111111111. There are more: http://en.wikipedia.org/wiki/Repunit

  23. Paul Rey
    October 26th, 2012 at 13:41

    7272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727­27272727 is ‘nt prime
    7272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727­27272727 = 7*1153*1823071297393296313794645482344582929229459 *4942723325027431973353637942171511505058571593
    PARI find it si not prime in 0ms and find the factorisation in 52 mn

  24. October 26th, 2012 at 15:59

    Hi Paul

    I copied your factorisation to Mathematica and got:
    In[3]:= 7*1153*1823071297393296313794645482344582929229459*
    4942723325027431973353637942171511505058571593

    Out[3]= 72727272727272727272727272727272727272727272727272727272727272\
    727272727272727272727272727277

    The last digit is a 7 and not a 2

1 trackbacks