Ask Your Question

sagemath1993's profile - activity

2021-10-02 01:57:48 +0200 received badge  Famous Question (source)
2019-01-29 05:38:28 +0200 received badge  Notable Question (source)
2018-01-06 23:37:01 +0200 received badge  Popular Question (source)
2016-09-01 17:24:21 +0200 received badge  Scholar (source)
2016-09-01 17:24:18 +0200 received badge  Supporter (source)
2016-09-01 03:08:39 +0200 asked a question 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?

2016-08-25 17:26:49 +0200 received badge  Student (source)
2016-08-25 03:43:09 +0200 commented answer Displaying large prime numbers as 10^a + x?

Thank you! It seems my code is displaying the 2nd prime and the difference between the 2nd and 1st prime after 10^a instead of displaying the first prime after 10^a

2016-08-25 02:09:55 +0200 received badge  Editor (source)
2016-08-25 01:55:27 +0200 asked a question Displaying large prime numbers as 10^a + x?

I just started using SAGE and I wanted to display my large prime numbers as 10^a + x, rather than it having it spit out a ton of zeros.

So far my code looks like

  a=100;
P= next_prime(10^a);
next_prime(P)
next_prime(P)- next_prime(10^a);

With this, it outputs the very large number and while I know how to write it down as 10^a + x (in this case, 10^100 + 949), how do I add that to the code so it would display it like that?