Guest User

Untitled

a guest
Jun 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. sage: G = GaussianIntegers()
  2. sage: r = 30
  3. sage: good = [] # prime and equal to 1 modulo (8 * ZZ[i])
  4. sage: nope = [] # others
  5. sage: for a in (-r .. r):
  6. ....: for b in (-r .. r):
  7. ....: g = G((a, b))
  8. ....: if a % 8 ==1 and g.is_prime():
  9. ....: good.append(g)
  10. ....: else:
  11. ....: nope.append(g)
  12. ....:
  13.  
  14. sage: plot_good = point2d(good, color='red', size=10)
  15. sage: plot_nope = point2d(nope, color='blue', size=1)
  16. sage: (plot_good + plot_nope).show(aspect_ratio=1, figsize=7)
  17. Launched png viewer for Graphics object consisting of 2 graphics primitives
  18.  
  19. sage: (plot_good + plot_nope).save('gaussian_primes.png', aspect_ratio=1, figsize=7)
  20.  
  21. sage: [g for g in good if not g.norm().is_prime()]
  22. [-23, -7]
Add Comment
Please, Sign In to add comment