
# q-expansion of newform 322.4.a.f, downloaded from the LMFDB on 22 February 2026.

# We generate the q-expansion using the Hecke eigenvalues a_p at the primes.
# Each a_p is given as a linear combination
# of the following basis for the coefficient ring.

def make_data():

    from sage.all import prod, floor, prime_powers, gcd, QQ, primes_first_n, next_prime, RR

    def discrete_log(elts, gens, mod):
        # algorithm 2.2, page 16 of https://arxiv.org/abs/0903.2785
        def table_gens(gens, mod):
            T = [1]
            n = len(gens)
            r = [None]*n
            s = [None]*n
            for i in range(n):
                beta = gens[i]
                r[i] = 1
                N = len(T)
                while beta not in T:
                    for Tj in T[:N]:
                        T.append((beta*Tj) % mod)
                    beta = (beta*gens[i]) % mod
                    r[i] += 1
                s[i] = T.index(beta)
            return T, r, s
        T, r, s = table_gens(gens, mod)
        n = len(gens)
        N = [ prod(r[:j]) for j in range(n) ]
        Z = lambda s: [ (floor(s/N[j]) % r[j]) for j in range(n)]
        return [Z(T.index(elt % mod)) for elt in elts]
    def extend_multiplicatively(an):
        for pp in prime_powers(len(an)-1):
            for k in range(1, (len(an) - 1)//pp + 1):
                if gcd(k, pp) == 1:
                    an[pp*k] = an[pp]*an[k]
    from sage.all import PolynomialRing, NumberField, ZZ
    R = PolynomialRing(QQ, "x")
    f = R(poly_data)
    K = NumberField(f, "a")
    betas = [K([c/ZZ(den) for c in num]) for num, den in basis_data]
    convert_elt_to_field = lambda elt: sum(c*beta for c, beta in zip(elt, betas))
    # convert aps to K elements
    primes = primes_first_n(len(aps_data))
    good_primes = [p for p in primes if not p.divides(level)]
    aps = map(convert_elt_to_field, aps_data)
    if not hecke_ring_character_values:
        # trivial character
        char_values = dict(zip(good_primes, [1]*len(good_primes)))
    else:
        gens = [elt[0] for elt in hecke_ring_character_values]
        gens_values = [convert_elt_to_field(elt[1]) for elt in hecke_ring_character_values]
        char_values = dict([(
            p,prod(g**k for g, k in zip(gens_values, elt)))
            for p, elt in zip(good_primes, discrete_log(good_primes, gens, level))
            ])
    an_list_bound = next_prime(primes[-1])
    an = [0]*an_list_bound
    an[1] = 1
    
    from sage.all import PowerSeriesRing
    PS = PowerSeriesRing(K, "q")
    for p, ap in zip(primes, aps):
        if p.divides(level):
            euler_factor = [1, -ap]
        else:
            euler_factor = [1, -ap, p**(weight - 1) * char_values[p]]
        k = RR(an_list_bound).log(p).floor() + 1
        foo = (1/PS(euler_factor)).padded_list(k)
        for i in range(1, k):
            an[p**i] = foo[i]
    extend_multiplicatively(an)
    return PS(an)
level = 322
weight = 4
poly_data = [46, 26, -42, -1, 1]

# The entries in the following list give a basis for the
# coefficient ring in terms of a root of the defining polynomial above.
# Each line consists of the coefficients of the numerator, and a denominator.
basis_data  = [[[1, 0, 0, 0], 1], [[0, 1, 0, 0], 1], [[-42, -41, 2, 1], 5], [[63, -41, -3, 1], 5]]

hecke_ring_character_values = None
aps_data = [[-2, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [7, 0, 0, 0], [-19, 3, 2, 3], [-8, 3, 3, -2], [-12, 4, -3, -6], [-4, 4, 4, 8], [-23, 0, 0, 0], [-35, 20, 3, 5], [-44, 27, 10, 10], [-16, -40, -4, -22], [-138, -31, 9, 8], [14, -22, 10, 6], [-158, -47, -8, -4], [-246, 38, -26, -4], [-370, 42, -13, -18], [-26, 52, -21, -38], [-59, -7, -48, -41], [-40, 25, -15, -8], [-554, 15, 29, 36], [-565, -33, 32, 45], [-10, -122, 30, -50], [90, 54, -19, 8], [700, 58, -37, -28], [-206, 180, 14, 0], [40, -42, 86, 44], [-686, -142, 38, 2], [434, 30, 36, 8], [-222, -170, -6, -36], [598, -143, -63, 66], [-180, -153, 68, 18], [20, 18, 134, 114], [870, 223, 40, 134], [362, 42, -58, -136], [1370, -13, 11, -22], [454, 58, 91, 80], [-10, -435, 111, 174], [-124, 340, -41, 154], [518, -156, -208, -144], [-254, -283, -11, 10], [2464, -238, -89, -22], [-2038, -566, -18, -122], [1694, -475, -233, -248], [442, 9, -83, -28], [-1088, 230, -230, 24], [174, -86, -214, 58], [558, -774, -323, -238], [-782, -738, -16, 58], [-230, -24, 123, -108], [-2379, 66, 241, -131], [-1490, 379, -41, 182], [1580, -90, 123, -230], [-644, 386, 306, 60], [-2254, -791, 129, 56], [-2135, -181, 226, 371], [-674, -501, -81, 68], [-742, -350, -265, -250], [-745, 826, -205, -105], [-1062, 1148, -170, -272], [-262, -464, -246, 258], [-1146, -372, 261, 502], [1602, 334, 227, 500], [198, 1173, 164, 474], [106, -708, -77, 368], [-3149, 93, -318, -413], [1256, -509, -267, -140], [-2634, 160, -102, -328], [-1526, 414, 358, -534], [6412, -195, -57, -54], [4720, -1107, -383, -518], [-211, 709, -76, -73], [-618, 798, -522, -206], [1090, 1632, 84, 592], [2317, 847, 406, 367], [-5782, 152, 340, 590], [3506, -586, -448, -216], [364, 1391, -21, -194], [-1110, 124, -542, 328], [4068, -635, -379, -478], [3640, -340, 112, 304], [-1178, 458, -142, 416], [-7584, 994, -162, -448], [6922, 548, 539, 322], [4184, 1189, 466, 180], [-366, 1635, 29, 294], [4923, 245, 402, 559], [-5264, -960, 646, -602], [-3126, -61, -77, 208], [-9528, -120, 190, 488], [432, 1078, 326, 380], [4102, 344, 402, 886], [-5912, -509, 379, -388], [424, -1329, -713, -776], [-2084, -967, 759, -132], [-522, -1794, -780, -550], [1488, 1609, -869, -994], [-6256, -2472, 433, -544], [-3886, 1024, -54, -738], [2107, -666, 275, -877], [-1646, -255, -143, 898], [-11086, 2052, 896, 0], [8086, -708, -794, -1830], [2320, -1276, -1032, 582], [-7670, 1756, 420, 954], [-1384, -2439, -87, 778], [-1842, -355, -142, 1158], [5448, 942, 200, -550], [-10290, 2466, -490, -526], [-14864, 345, 677, 114], [290, 3194, 865, 876], [-12250, -1168, 522, -832], [-2272, -2636, 424, -410], [5590, -1464, -1096, 594], [-6829, -5, -1060, -1431], [-5896, 1756, -1024, 134], [-2122, -998, -1716, -506], [-10150, 281, -1102, -936], [-9622, -3041, 647, 508], [-3708, -674, 974, -88], [-4732, -2516, -1319, -792], [-1679, 3610, -467, -963], [-7606, 2470, 441, 1366], [-4642, 1613, 971, -274], [-42, 2562, 235, 792], [-4836, 2562, 726, 266], [1966, 1990, -1240, -1468], [8570, -574, 1647, 248], [-8608, -2948, 508, -132], [-12580, 764, 995, 1164], [-12652, 3099, 331, 936], [-5377, 2119, 1000, 757], [-19159, -19, 448, 83], [6580, 1802, -1098, 1310], [6498, 1091, 1085, 228], [-9678, 1186, 1629, -1048], [16740, 466, 1281, 1326], [392, -624, -566, -72], [-17008, 440, 433, -1182], [9782, 396, -922, -16], [-13372, -4689, 1252, 1458], [-6275, 2295, -394, -1635], [-9098, 3215, -1351, -30], [27520, -812, -416, -308], [-4312, -3906, -1044, -262], [17706, -1080, -184, -990], [9404, -474, -2114, -1246], [1882, 529, 525, 1436], [14684, -1705, -226, -1204], [10892, -2969, 83, 1640], [-3027, 1895, -1034, -1859], [10382, -3512, 2017, 484], [14330, -2586, -1942, 878], [68, -681, -708, -896], [-7752, 4916, -1488, -340], [25559, -5763, -746, 921], [6169, -605, 1022, 35], [19218, -1363, -103, -436], [-28348, 3144, 1667, 2978], [2594, -4660, 947, -164], [15564, 1889, 1671, 508], [1296, 8698, 2140, 3022], [26022, -3655, -1593, -2106], [25784, -36, 738, -1492], [1698, 274, -2280, -1852], [-2702, 4002, 2586, -354], [-4620, 5756, 2032, 1328], [-14778, -6372, 388, -1088], [11596, -1060, 2438, -1142], [6194, 2321, 731, -24], [19318, 738, -78, 358], [-23496, -6071, -429, -846], [-7948, 1612, -572, 532], [3418, -4632, 2286, 3276], [-10368, -87, -1734, -2062], [26878, -2524, 1459, -76], [-16484, 2887, -841, 1944], [-7554, -7973, 1047, -752], [-35718, -2, -464, 322], [38358, -2030, -197, 206], [13826, 5109, -259, 886], [-28246, 2638, 736, -1958], [-4974, -5835, 2047, -2280], [-18982, 5748, 1450, 3380], [-970, -9852, -868, -678], [16142, -7370, -889, -786], [-32275, -181, -38, -2167], [2156, -1078, 984, -1508], [-2785, 7146, -761, 363], [-6130, 3174, -1853, 322], [-44676, -1689, -631, -646], [8400, -764, 3896, 3048], [16336, -2468, -2852, -1852], [-22048, -8666, 406, -678], [28927, 4627, 2072, 733], [-12802, -954, -1561, -1550], [-34402, -206, -200, 312], [17496, -1114, 1270, -4706], [7682, 4392, 507, -2430], [-354, -961, 3444, 2386], [-16438, 424, 912, -2176], [-20958, -1822, -4357, -2904], [-11318, 3347, 2039, 3472], [16828, 7114, -1577, 260], [14258, 4060, 1242, -626], [16446, 67, -1097, -3772], [-7626, 10058, 2666, 2938], [-26654, 7175, 1199, -106], [-12497, -1004, 3373, 2247], [-5482, -2521, 1694, 1364], [-18107, 190, 2637, 73], [5058, -6571, -1841, 860], [-16433, 6721, 2946, 4673], [7248, 6004, 752, 1976], [-15518, 3514, -2829, 2000], [1572, 3738, -985, -2566], [-30610, 2139, -3465, -3418], [10626, -337, -2819, 1112], [11250, -3650, 3698, 1790], [-39742, 1199, -6337, -2420], [-2054, -2833, 4505, 4696], [-1454, 9518, -4468, -1710], [4746, -271, 3591, 716], [29018, 2460, -2544, -186], [4486, -3203, 342, 3350], [-29685, -6792, 2737, -3321], [25314, -2704, 889, -3066], [15338, 6833, -1511, -3254], [-21052, -1976, 270, -1264], [18972, -6424, 948, -3396], [31278, -12248, -2392, 2064], [26382, 5216, 1758, 974], [6153, 6371, 5094, 4583], [-66187, 4099, 1154, 1521], [3854, 564, -3958, -1290], [-302, -2512, -2252, -5582], [25194, -6174, -4015, 2968], [-37076, -2438, -520, 1890], [5744, 9697, -1453, -1988], [3840, -12971, -1104, 422], [24398, -4980, 1644, 462], [-35012, -3565, -1384, 786], [-31984, -857, 2664, 802], [2370, -9905, -829, 2924], [20062, 8484, 3340, 5412], [-11020, 5331, 540, 854], [-28984, -16973, 190, -4612], [-4830, 8616, 3548, 7298], [9748, -5668, -4456, -504], [-33400, 8046, -1466, -1296], [-13612, -5502, 1936, 822], [-16514, 6288, 4497, -4382], [-73289, 2719, -480, 4065], [30810, 1036, 4429, -1952], [25250, -3752, 4010, -352], [-15850, -4955, 433, -626], [29284, 4100, -2080, -4466], [54340, 9182, -2390, 3176], [36288, 4781, 2931, -802], [-5162, 15543, -335, -3524], [10563, 137, -3138, -3167], [5444, -5534, 5054, 4088], [-29372, 10454, 2220, -2530], [29638, 7462, -243, 3050], [-43058, 6284, -3436, -328], [10580, 17186, 2054, 6440], [-9480, -13814, -6412, -5226], [34134, 10516, -1175, 5450], [-31645, -2585, -5184, 1373], [10266, -11199, -4827, -2964], [-36530, 6711, -29, -872], [32747, -13119, -3130, -1739], [53140, -2974, -2645, 3362], [-825, 1845, -3006, 5649], [-73352, 11249, 2529, 534], [-7870, 1417, -6224, -2196], [-26416, -1900, -3800, 2548], [3709, 13131, 3722, 6401], [46526, -7780, 6508, 4256], [20126, 5614, 1780, 3874], [-1464, -1159, -8046, -3652], [-5974, 5026, -6758, -4490], [16366, -5034, 1070, -6258], [60762, -1720, -2711, -3300], [-15252, 8128, -2603, -3716], [-44000, 2816, -5214, 2240], [5950, -9494, 3934, 7512], [-38354, 4836, 4152, 8244], [-32356, -18244, 3523, 1520], [107330, -7280, -2038, -1452], [28646, -6740, 5112, -4896], [-57282, -17904, 1262, -726], [-23365, -2439, 6458, -4173], [9936, -338, 556, -4912], [-40154, -7307, 2725, 4280], [-31228, 4822, -6111, 454], [-74022, -10790, 660, -74], [46616, -10861, 6411, 5214], [71546, 12491, -3232, 1570], [-57386, 10331, -2550, 86], [-50098, 3138, -5777, 2716], [-50468, -5678, -7418, -3286], [-55744, 134, 290, -2800], [4564, -16261, 7581, 1476], [-20668, 5118, 5314, 3824], [19762, -16385, 4701, 1180], [77774, 19306, -2128, 1158], [31508, -9982, 1835, 3568], [-57496, 11254, 6162, 3312], [13098, 1664, -3694, -6232], [-1114, -14111, -1632, -4168], [14488, -20016, -1208, 3102], [-54622, 9770, 3604, -1868], [-2456, -9597, 4451, 8632], [6647, 23221, 3062, 4417], [96966, 11842, -285, 2050], [23304, 2001, -3288, -10952], [-31652, 19345, 4821, 1280], [31952, -18640, -1825, 644], [-30794, 4555, 325, 2552], [-8106, 4428, -2668, -3534], [-6176, 3306, 3070, -7194], [45150, -18751, -1141, -856], [-12700, 22464, 5310, 5364], [67214, 2136, 3896, 504], [42984, -6856, -1601, 3252], [42234, -2620, 776, -3438], [5426, 191, 1568, -8308], [27807, -2643, 834, 5421], [49686, -8322, -8192, -13964], [-72913, 9250, -6941, -4317], [-5214, 1371, -1091, 5200], [-56616, 14825, 3560, 2238], [-33786, -10097, 5546, -3050], [22583, 8729, -1642, -7291], [88584, 7893, -4062, -2416], [36158, -354, 8104, 1488], [-45298, -17230, -7067, -6132], [87444, -6709, 649, 6562], [-3270, -26914, 4442, 178], [147573, 126, 1165, -1435], [-29824, -12516, 5380, 9146], [-53494, 9128, 2534, -236], [1120, -7922, -2510, 4736], [68910, -2238, -2764, -320], [57224, -12536, -4340, 4152], [45870, -16335, 263, -6536], [32080, 28092, 4566, 8304], [4978, 20, 2130, 3114], [-18892, 24034, 8979, 8982], [-92944, 2883, -4566, -4542], [123010, -4039, -1737, -7748], [16087, 18225, 3642, 5367], [25252, -19326, -2760, -4052], [34174, -4482, -2126, -3940], [18748, -7870, 3798, -8186], [-74082, 12042, -9530, -2534], [-27600, 8960, -5844, -48], [-68571, -10628, -3621, -9791], [91172, 5452, -1832, -6824], [83000, -10132, -8066, -13726], [-73772, -2095, 3005, 4238], [-17440, -9337, -1225, 3580], [-69385, 15469, 834, 2861], [58636, 4065, -4598, -5150], [-3538, -24119, -2191, -2724], [84456, -10201, 367, -1042], [109717, 3911, 8794, 2407], [7742, 8854, 3870, 376], [31734, 29697, -3757, 974], [-57860, 33352, 12055, 13052], [-54890, -11625, -7673, -5626], [-7744, -1544, 7574, 662], [16618, 30848, -4192, -5130], [78850, -12117, -5435, -1152], [38294, -15625, -6020, -12216], [-21110, 18894, 78, -8378], [86586, 116, 3079, 3362], [43300, 638, 2611, 692], [32736, 6191, -7087, -14342], [-40418, 27846, -7185, -5090], [8252, -10318, 5940, -2962], [-62818, 910, 4156, 1842], [-111038, -22141, -1005, -4344], [-93680, -6522, -5258, -8076], [-92880, -5327, 9054, 19644], [-58712, 23135, 9843, 8776], [66022, 2216, 4388, 9148], [109441, -5107, -5448, -10005], [-68052, 26478, 3964, 1120], [-87218, -10054, 3228, -3348], [-19696, 34422, 2524, 3670], [-63558, 6703, -6957, -7706], [92070, -20818, -5585, -4730], [-106789, -18597, 692, 2893], [19330, -1808, -786, 6576], [149486, 5262, -4238, -50], [-26898, 18820, 3001, 12180], [79430, 25736, 468, 2702], [7127, 7937, 5398, 8263], [-37960, -5001, -14637, -2242], [-7307, -11780, 8347, 6473], [-111277, -15865, 3052, -8103], [26284, -26126, -9723, -3446], [-140758, 14221, 783, 3524], [-57808, -12621, 4810, -1116], [-30256, 21726, 8316, 16530], [38978, -6711, -13447, -13744], [-79032, -17502, -4060, 2532], [148530, -5522, 11709, 8192], [-52424, -17737, -8375, -11946], [-27774, -4209, -12463, 8384], [18156, -31192, -852, -2048], [30420, -22854, 2206, -6344], [-87396, 8176, -6264, -2242], [-57114, -21205, -16441, -14652], [-62154, 7602, -1878, -2918], [-42142, 25774, -2615, -2100], [-52448, 12666, 1863, -6176], [91324, -20850, -3054, 4544], [-158074, -11476, -278, 3804], [38478, 12792, 14295, 800], [63122, 7786, -3138, 786], [-134384, -11076, 4069, 11928], [54632, -11807, -8735, -6234], [6476, 27411, -11353, -15906], [80611, 20173, 2086, -3739], [15534, 5392, 2018, 6760], [151962, 8661, -4302, -5646], [60020, -16181, 4182, -12168]]
