Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I convert a 300-digit number to scientific notation?

a=300
P0= next_prime(10^a)
print( ' p0 is 10^{} + {}'.format(a, P0 - 10^a) );
P1 = next_prime(P0)
print( ' p1 is 10^{} + {}'.format(a, P1 - 10^a) );
P2 = next_prime(P1)
print( ' p2 is 10^{} + {}'.format(a, P2 - 10^a) );

F=GF(P0)
g=F(10)
h=g^(-1)
print h;
print h*g;

With this code, I get a massive number for h and 1 for h*g as desired. How can I convert h to scientific notation (in this case, 90000000...000298 = 9 x 10^ + 298?