GP compiler problem

asked 2021-07-12 09:48:54 +0100

prathamlalwani gravatar image

updated 2021-07-14 20:15:22 +0100

FrédéricC gravatar image

When I do individual calculations the algorithm seems to be fine but when I do multiple iterations it crashes, any help is super appreciated.

from sage.all_cmdline import *   # import sage library

non_square = [2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

for k in non_square:
    K = gp.bnfinit(x^2 - k)
    XY = []
    Y = []
    for i in range(1, 100):
        x = gp.bnrclassno(K, i)
        XY.append([x, euler_phi(i)])
print(XY)

# scatter_plot(XY, markersize=100, facecolor='green', ymax=100).save('new1.png')
list_plot(XY).save('new' + str(k) + '.png')
del(K)
edit retag flag offensive close merge delete