Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sage: G = GaussianIntegers()
- sage: r = 30
- sage: good = [] # prime and equal to 1 modulo (8 * ZZ[i])
- sage: nope = [] # others
- sage: for a in (-r .. r):
- ....: for b in (-r .. r):
- ....: g = G((a, b))
- ....: if a % 8 ==1 and g.is_prime():
- ....: good.append(g)
- ....: else:
- ....: nope.append(g)
- ....:
- sage: plot_good = point2d(good, color='red', size=10)
- sage: plot_nope = point2d(nope, color='blue', size=1)
- sage: (plot_good + plot_nope).show(aspect_ratio=1, figsize=7)
- Launched png viewer for Graphics object consisting of 2 graphics primitives
- sage: (plot_good + plot_nope).save('gaussian_primes.png', aspect_ratio=1, figsize=7)
- sage: [g for g in good if not g.norm().is_prime()]
- [-23, -7]
Add Comment
Please, Sign In to add comment