Program: (PARI) va(n) = my(u=[]); for(i=0, n-1, if(!sum(j=0, n-1, gcd(j,n)==1&&issquare(Mod(j,n))&&(i*j)%n<i), u=concat(u, [i]))); u vb(n) = my(u=[]); forstep(i=1, 4*n-3, 4, if(!sum(j=0, 4*n-1, gcd(j,4*n)==1&&issquare(Mod(j,4*n))&&(i*j)%(4*n)<i), u=concat(u, [i]))); u ga(n) = print1("x^2 - c: "); print1(va(n)); print(" (mod ", n, ")") gb(n) = print1("x^2 - x - (c - 1)/4: "); print1(vb(n)); print(" (mod ", 4*n, ")") ext(n) = print("Z_", n, "[x]/f(x), where f(x) = "); if(n%2, ga(n), if(n%4==2, ga(n/2); gb(n), ga(n); gb(n/2))); print("Total number = ", if(n%2, #va(n), if(n%4==2, #va(n/2)+#vb(n), #va(n)+#vb(n/2)))) n = 1: Z_1[x]/f(x), where f(x) = x^2 - c: [0] (mod 1) Total number = 1 n = 2: Z_2[x]/f(x), where f(x) = x^2 - c: [0] (mod 1) x^2 - x - (c - 1)/4: [1, 5] (mod 8) Total number = 3 n = 3: Z_3[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 3) Total number = 3 n = 4: Z_4[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3] (mod 4) x^2 - x - (c - 1)/4: [1, 5] (mod 8) Total number = 6 n = 5: Z_5[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 5) Total number = 3 n = 6: Z_6[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 3) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21] (mod 24) Total number = 9 n = 7: Z_7[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 7) Total number = 3 n = 8: Z_8[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7] (mod 8) x^2 - x - (c - 1)/4: [1, 5] (mod 16) Total number = 10 n = 9: Z_9[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6] (mod 9) Total number = 5 n = 10: Z_10[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 5) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25] (mod 40) Total number = 9 n = 11: Z_11[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 11) Total number = 3 n = 12: Z_12[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] (mod 12) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21] (mod 24) Total number = 18 n = 13: Z_13[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 13) Total number = 3 n = 14: Z_14[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 7) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 29, 49] (mod 56) Total number = 9 n = 15: Z_15[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 10, 11] (mod 15) Total number = 9 n = 16: Z_16[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14] (mod 16) x^2 - x - (c - 1)/4: [1, 5] (mod 32) Total number = 14 n = 17: Z_17[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 17) Total number = 3 n = 18: Z_18[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6] (mod 9) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 33, 45, 57, 69] (mod 72) Total number = 15 n = 19: Z_19[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 19) Total number = 3 n = 20: Z_20[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 8, 10, 11, 13, 15] (mod 20) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25] (mod 40) Total number = 18 n = 21: Z_21[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 7, 9, 10, 14] (mod 21) Total number = 9 n = 22: Z_22[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 11) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 33, 77] (mod 88) Total number = 9 n = 23: Z_23[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 23) Total number = 3 n = 24: Z_24[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] (mod 24) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21] (mod 48) Total number = 30 n = 25: Z_25[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 5, 10] (mod 25) Total number = 5 n = 26: Z_26[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 13) x^2 - x - (c - 1)/4: [1, 5, 13, 29, 33, 65] (mod 104) Total number = 9 n = 27: Z_27[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 9, 18] (mod 27) Total number = 7 n = 28: Z_28[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 14, 21] (mod 28) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 29, 49] (mod 56) Total number = 18 n = 29: Z_29[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 29) Total number = 3 n = 30: Z_30[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 10, 11] (mod 15) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 25, 29, 33, 41, 45, 53, 61, 65, 73, 85, 93, 105] (mod 120) Total number = 27 n = 31: Z_31[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 31) Total number = 3 n = 32: Z_32[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28] (mod 32) x^2 - x - (c - 1)/4: [1, 5] (mod 64) Total number = 18 n = 33: Z_33[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 11, 22] (mod 33) Total number = 9 n = 34: Z_34[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 17) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 41, 85] (mod 136) Total number = 9 n = 35: Z_35[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 14, 15] (mod 35) Total number = 9 n = 36: Z_36[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 18, 21, 24, 27, 30, 33] (mod 36) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 33, 45, 57, 69] (mod 72) Total number = 30 n = 37: Z_37[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 37) Total number = 3 n = 38: Z_38[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 19) x^2 - x - (c - 1)/4: [1, 5, 13, 33, 57, 133] (mod 152) Total number = 9 n = 39: Z_39[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 7, 13, 14, 26] (mod 39) Total number = 9 n = 40: Z_40[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 20, 21, 22, 25, 26, 30, 31, 35] (mod 40) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25] (mod 80) Total number = 30 n = 41: Z_41[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 41) Total number = 3 n = 42: Z_42[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 7, 9, 10, 14] (mod 21) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 29, 33, 37, 45, 49, 65, 73, 77, 93, 105, 133, 161] (mod 168) Total number = 27 n = 43: Z_43[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 43) Total number = 3 n = 44: Z_44[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 7, 8, 11, 13, 14, 22, 33] (mod 44) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 33, 77] (mod 88) Total number = 18 n = 45: Z_45[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 15, 18, 21, 30, 33] (mod 45) Total number = 15 n = 46: Z_46[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 23) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 69, 161] (mod 184) Total number = 9 n = 47: Z_47[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 47) Total number = 3 n = 48: Z_48[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46] (mod 48) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21] (mod 96) Total number = 42 n = 49: Z_49[x]/f(x), where f(x) = x^2 - c: [0, 1, 3, 7, 21] (mod 49) Total number = 5 n = 50: Z_50[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 5, 10] (mod 25) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25, 65, 85, 105, 125] (mod 200) Total number = 15 n = 51: Z_51[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 7, 9, 17, 34] (mod 51) Total number = 9 n = 52: Z_52[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 7, 8, 10, 13, 26, 39] (mod 52) x^2 - x - (c - 1)/4: [1, 5, 13, 29, 33, 65] (mod 104) Total number = 18 n = 53: Z_53[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 53) Total number = 3 n = 54: Z_54[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 9, 18] (mod 27) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 33, 45, 57, 69, 81, 117, 153, 189] (mod 216) Total number = 21 n = 55: Z_55[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 10, 11, 22] (mod 55) Total number = 9 n = 56: Z_56[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 21, 22, 24, 28, 29, 31, 35, 42, 49] (mod 56) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 29, 49] (mod 112) Total number = 30 n = 57: Z_57[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 10, 19, 38] (mod 57) Total number = 9 n = 58: Z_58[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 29) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 29, 145] (mod 232) Total number = 9 n = 59: Z_59[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 59) Total number = 3 n = 60: Z_60[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 24, 25, 28, 29, 30, 33, 34, 35, 39, 40, 44, 45, 50, 55] (mod 60) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 25, 29, 33, 41, 45, 53, 61, 65, 73, 85, 93, 105] (mod 120) Total number = 54 n = 61: Z_61[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 61) Total number = 3 n = 62: Z_62[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 31) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 93, 217] (mod 248) Total number = 9 n = 63: Z_63[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 9, 10, 14, 15, 21, 27, 30, 42] (mod 63) Total number = 15 n = 64: Z_64[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56] (mod 64) x^2 - x - (c - 1)/4: [1, 5] (mod 128) Total number = 22 n = 65: Z_65[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 10, 13, 26] (mod 65) Total number = 9 n = 66: Z_66[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 11, 22] (mod 33) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 29, 33, 37, 45, 57, 73, 77, 89, 121, 165, 209, 253] (mod 264) Total number = 27 n = 67: Z_67[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 67) Total number = 3 n = 68: Z_68[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 12, 15, 17, 34, 51] (mod 68) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 41, 85] (mod 136) Total number = 18 n = 69: Z_69[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 7, 15, 23, 46] (mod 69) Total number = 9 n = 70: Z_70[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 14, 15] (mod 35) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25, 29, 37, 41, 49, 57, 61, 77, 85, 105, 145, 217, 245] (mod 280) Total number = 27 n = 71: Z_71[x]/f(x), where f(x) = x^2 - c: [0, 1, 7] (mod 71) Total number = 3 n = 72: Z_72[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69] (mod 72) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 33, 45, 57, 69] (mod 144) Total number = 50 n = 73: Z_73[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 73) Total number = 3 n = 74: Z_74[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 37) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 37, 185] (mod 296) Total number = 9 n = 75: Z_75[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 10, 11, 15, 25, 30, 35, 50, 55] (mod 75) Total number = 15 n = 76: Z_76[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 6, 7, 8, 13, 19, 38, 57] (mod 76) x^2 - x - (c - 1)/4: [1, 5, 13, 33, 57, 133] (mod 152) Total number = 18 n = 77: Z_77[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 7, 11, 14, 33] (mod 77) Total number = 9 n = 78: Z_78[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 7, 13, 14, 26] (mod 39) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 29, 33, 37, 41, 61, 65, 69, 73, 117, 169, 221, 273] (mod 312) Total number = 27 n = 79: Z_79[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 79) Total number = 3 n = 80: Z_80[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 24, 25, 26, 30, 31, 32, 34, 35, 40, 42, 44, 50, 52, 60, 62, 70] (mod 80) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25] (mod 160) Total number = 42 n = 81: Z_81[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 6, 9, 18, 27, 54] (mod 81) Total number = 9 n = 82: Z_82[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 41) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 41, 205] (mod 328) Total number = 9 n = 83: Z_83[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 83) Total number = 3 n = 84: Z_84[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 26, 28, 29, 33, 35, 36, 40, 42, 43, 47, 49, 56, 63, 70, 77] (mod 84) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 29, 33, 37, 45, 49, 65, 73, 77, 93, 105, 133, 161] (mod 168) Total number = 54 n = 85: Z_85[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 15, 17, 34] (mod 85) Total number = 9 n = 86: Z_86[x]/f(x), where f(x) = x^2 - c: [0, 1, 2] (mod 43) x^2 - x - (c - 1)/4: [1, 5, 13, 33, 129, 301] (mod 344) Total number = 9 n = 87: Z_87[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 10, 29, 58] (mod 87) Total number = 9 n = 88: Z_88[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 13, 14, 15, 16, 17, 19, 22, 26, 28, 33, 44, 55, 66, 77] (mod 88) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 33, 77] (mod 176) Total number = 30 n = 89: Z_89[x]/f(x), where f(x) = x^2 - c: [0, 1, 3] (mod 89) Total number = 3 n = 90: Z_90[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 15, 18, 21, 30, 33] (mod 45) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21, 25, 29, 33, 41, 45, 53, 57, 61, 65, 69, 73, 85, 93, 105, 117, 129, 153, 165, 189, 213, 225, 249, 285, 345] (mod 360) Total number = 45 n = 91: Z_91[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 7, 13, 14, 39] (mod 91) Total number = 9 n = 92: Z_92[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 7, 10, 20, 23, 46, 69] (mod 92) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 69, 161] (mod 184) Total number = 18 n = 93: Z_93[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 9, 11, 13, 31, 62] (mod 93) Total number = 9 n = 94: Z_94[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 47) x^2 - x - (c - 1)/4: [1, 5, 21, 33, 141, 329] (mod 376) Total number = 9 n = 95: Z_95[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 5, 7, 10, 14, 19, 38] (mod 95) Total number = 9 n = 96: Z_96[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92] (mod 96) x^2 - x - (c - 1)/4: [1, 5, 9, 13, 17, 21] (mod 192) Total number = 54 n = 97: Z_97[x]/f(x), where f(x) = x^2 - c: [0, 1, 5] (mod 97) Total number = 3 n = 98: Z_98[x]/f(x), where f(x) = x^2 - c: [0, 1, 3, 7, 21] (mod 49) x^2 - x - (c - 1)/4: [1, 5, 17, 21, 29, 49, 77, 105, 217, 245] (mod 392) Total number = 15 n = 99: Z_99[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 5, 6, 7, 9, 11, 15, 18, 21, 22, 33, 66] (mod 99) Total number = 15 n = 100: Z_100[x]/f(x), where f(x) = x^2 - c: [0, 1, 2, 3, 4, 5, 6, 8, 10, 11, 13, 15, 20, 25, 30, 40, 50, 55, 65, 75] (mod 100) x^2 - x - (c - 1)/4: [1, 5, 13, 17, 21, 25, 65, 85, 105, 125] (mod 200) Total number = 30