CoCalc Public FilesTESTS / nines.sagews
Author: Hal Snyder
Views : 79
Description: An interesting prime number
Compute Environment: Ubuntu 18.04 (Deprecated)

An interesting prime number

especially for users of base-ten notation

I saw the following number, allegedly prime, in the twitter stream of Cliff Pickover:

The number consists of 252 9's, then a single digit 8, then 253 9's'

This file is a Sage worksheet with a brief calculation to confirm the number's primality.

- Hal Snyder

prefix_len = 3 * 74 + 30
suffix_len = 43 + 2 * 74 + 62

seg_len = [prefix_len, 1, suffix_len]
seg_len
sum(seg_len)

[252, 1, 253] 506
digits = ['9', '8', '9']
xstrs = [seg_len[k]*digits[k] for k in range(len(digs))]
xstr = ''.join(xstrs)

xi = int(xstr)
factor(xi)

99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
# how long does it take Sage to check that the number is prime?
%time is_prime(xi)


True CPU time: 18.91 s, Wall time: 20.28 s