| 1 | initial version |
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.
| 2 | No.2 Revision |
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) )
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.