Ask Your Question

Revision history [back]

One simple way is to use a formatted Python string like '10^{}+{}'.format(a,difference). Here's some code that prints the decomposition of the first five primes above 10^a:

a = 100
p = 10^a

for i in range(0,5):
    p = next_prime(p)
    print( '10^{}+{}'.format(a, p - 10^a) )

and here's a live example.

One simple way is to use a formatted Python string like like

'10^{}+{}'.format(a,difference)'10^{} + {}'.format(a,difference)
. 

Here's some code that prints the decomposition of the first five primes above 10^a:

a = 100
p = 10^a

for i in range(0,5):
    p = next_prime(p)
    print( '10^{}+{}'.format(a, '10^{} + {}'.format(a, p - 10^a) )

and here's a live example.