On Sun, Jul 24, 2011 at 10:46 AM, John Cremona <john.crem...@gmail.com>wrote:
> > > On Jul 24, 1:24 pm, raman <raman.kurdi2...@gmail.com> wrote: > > Hi Dears > > First I must find all primes in the form p=8k+1 or p=8k+7 in range > > 10000. > > [p for p in prime_range(10^4) if p%8 in [1,7]] > > > > Second I should find the all integers a and b such that p=a^2-2b^2 in > > range 10000. > > [list(K.ideal(p).factor()[0][0].gens_reduced()[0]) for p in > prime_range(10^4) if p%8 in [1,7]] > Do sage: K = QQ[sqrt(2)] sage: [list(K.ideal(p).factor()[0][0].gens_reduced()[0]) for p in prime_range(10^4) if p%8 in [1,7]] > > Explanation: the solution a,b is unique up to signs and a+b*sqrt(2) > is one of the prime factors in the rank Z[sqrt(2)]. > > I make no pretence that that either of the above is the most efficient > way of solving these! > > John Cremona > > > Could you please help me for writing this program? > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org