Dear John,
You make a slight mistake, the unit group of Z[sqrt(2)] has rank 1, so
although you have unique factorization up to units this might still give you
a lot of different a and b satisfying the criteria.
See for example:
sage: [a^2-2*b^2 for (a,b) in [(3, 1), (5, 3), (13, 9), (27, 19),
On Sun, Jul 24, 2011 at 10:46 AM, John Cremona wrote:
>
>
> On Jul 24, 1:24 pm, raman wrote:
> > Hi Dears
> > First I must find all primes in the form p=8k+1 or p=8k+7 in range
> > 1.
>
> [p for p in prime_range(10^4) if p%8 in [1,7]]
>
>
> > Second I should find the all integers a and b su
For the first question, since Sage has the prime_range() function: [p
for p in prime_range(1) if mod(p, 8) in (1, 7)]. There are several
ways of filtering a list in Python, but I tend to choose list
comprehensions (http://en.wikipedia.org/wiki/
List_comprehension#Python)
On Jul 24, 8:24 am, ra
On Jul 24, 1:24 pm, raman wrote:
> Hi Dears
> First I must find all primes in the form p=8k+1 or p=8k+7 in range
> 1.
[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 1.
[list(K.ideal(p).factor()[0][0].ge