
# q-expansion of newform 464.4.a.m, downloaded from the LMFDB on 25 April 2024.

# 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 = 464
weight = 4
poly_data = [-198, 94, 74, -34, -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, 0], 1], [[-90, 64, 23, -5, -1], 19], [[-109, 140, 23, -5, -1], 19], [[-203, -60, 134, -6, -5], 19], [[-829, -184, 283, -7, -9], 19]]

hecke_ring_character_values = None
aps_data = [[0, 0, 0, 0, 0], [-1, 1, 0, 0, 0], [2, 0, 0, 1, 0], [-6, 0, -1, 0, -1], [-8, 0, 1, -2, 2], [7, -5, 1, -1, -2], [17, -5, 2, -4, 1], [-31, -5, -1, -2, 2], [-64, -6, -9, 8, -5], [29, 0, 0, 0, 0], [-85, -13, 3, 0, 3], [0, 6, -2, 14, -12], [15, 17, 18, -2, -5], [-74, -14, 27, -30, 22], [-144, 18, 24, 6, 11], [-21, -9, -3, -15, 6], [-174, 12, -7, 8, -33], [-125, -27, -20, 4, 17], [-30, 50, -18, 0, 28], [-210, 2, -36, -4, 8], [-242, 72, 26, -2, 30], [-42, 0, 2, -10, 5], [-68, -46, 19, -40, -33], [-367, 71, -36, -26, -13], [-515, 27, -24, -6, 15], [-334, 36, -40, 78, -88], [-2, -94, -12, 16, -16], [418, -24, 5, -28, 49], [-324, -26, 78, -35, 80], [-96, 202, 54, -28, 16], [257, -73, 103, -26, 50], [323, -15, 73, -14, 74], [242, -176, 16, -150, 64], [810, 92, 25, 136, -29], [531, -201, -43, -93, -26], [-350, 68, 41, -20, -119], [169, -253, -104, 58, -153], [719, 117, -24, 116, 70], [-1170, 238, 2, 76, -102], [1192, 234, -212, 148, -98], [-42, -2, 56, -204, -60], [474, 108, -198, -21, -142], [-1427, 111, -3, -130, 96], [375, 281, -34, 154, -33], [1606, 472, -112, 140, -8], [-1370, 140, -197, 36, -29], [-21, 285, -22, 324, -180], [72, -176, 86, 72, -84], [-28, -516, -64, -24, 2], [-1317, 533, -80, -94, -139], [2206, 414, -15, 3, 97], [-1566, -468, -49, 136, -63], [1454, -530, -39, -187, 161], [349, 471, 0, 52, -10], [2775, -179, 134, 297, -117], [-1181, 287, 21, 336, 205], [839, 49, -188, 520, -175], [-397, 719, -185, 196, 33], [-1670, -188, -164, 92, 40], [688, -644, 51, 23, 181], [1398, 432, -71, 76, 19], [1726, -92, 290, -76, 62], [876, 100, -203, 142, -94], [-1035, 367, 277, -42, -40], [-1937, 505, 328, -111, 165], [1287, -119, 12, -360, 45], [-1017, 1205, -172, -60, 30], [-2437, -1183, -4, 92, 53], [922, -326, 100, -272, -152], [-4629, 383, -219, 65, -498], [1528, -186, -8, -320, -130], [1664, 2, -502, 66, 135], [-1131, -701, 287, -338, -62], [-262, 304, -792, 227, 24], [-263, -1013, 259, -570, -334], [-84, -850, -167, 228, -89], [3556, -562, -208, -58, 286], [-4512, -806, 122, 47, 32], [2468, -108, -467, -41, 307], [-4974, 152, 332, 320, 384], [878, -958, -186, 152, 62], [1695, 29, 802, -240, 315], [-7602, 1164, 461, 176, 251], [4406, 1440, -306, 354, -78], [-3624, 1870, 329, 120, 213], [-4349, 285, 179, 154, 104], [-2846, -52, -994, 780, -694], [-2600, -778, -212, 16, -110], [-1606, 1652, -304, 40, 300], [-3974, -668, -309, 200, -223], [-3074, 946, -261, 426, -618], [-689, -701, -513, 1004, -759], [-504, 958, 59, 16, 293], [-9242, -118, 205, -1026, 482], [6816, -914, 447, -32, -1], [2995, -681, -21, -956, -79], [-2873, -873, -217, -47, -12], [-1675, 963, 506, 415, -187], [-8718, 918, -44, 808, -634], [-8538, 416, 376, -842, 604], [-8662, -1276, -217, 444, 83], [-3722, -2224, -560, -196, 368], [-1853, -1239, 552, -916, 418], [-6832, -1718, 1326, -816, 860], [7980, -116, 386, 816, -366], [-6127, 1055, 920, -512, 471], [-2894, -1712, 647, -580, 565], [11903, -879, -484, -585, -207], [14392, -378, -540, -6, -135], [-10853, 657, -864, 258, 21], [-10041, -213, -9, 420, -231], [-270, -228, -734, 1333, -918], [4726, -636, -648, 1098, -340], [11469, -273, -394, 656, -518], [1592, 72, 186, 744, -724], [-2307, -697, 102, -1288, -259], [-3254, -1064, 957, -536, 705], [312, -966, 283, -188, -905], [1639, -1307, 1314, -846, 99], [9887, -1115, -994, 360, -930], [-1046, 2012, -600, 472, 172], [3666, -2474, -281, -447, 235], [-6238, 328, -50, 1448, -582], [1722, 82, -770, -540, -924], [-15818, 550, -262, 684, -328], [-2411, -651, 803, -1661, 958], [1373, -891, -293, -461, 286], [15196, 1564, 566, -444, 484], [-8171, -153, -759, -1002, 92], [17708, -154, 792, -374, 922], [4115, -635, 532, -736, 524], [9315, -819, 749, 650, 646], [-3237, 2709, -379, -142, -582], [-4091, 3011, -62, -316, 465], [13468, -1158, -724, 100, -1050], [3759, -2087, 342, -912, -1169], [-1783, 383, 230, 34, 957], [-8604, 1192, -822, 872, 772], [-19749, 3429, -80, -972, 1061], [-20746, -2776, 738, -602, 650], [-6844, 590, -1781, 500, -1055], [14585, 3501, 125, -497, -468], [2973, 843, -1153, 1246, -1474], [-9963, -2869, -76, -632, 1112], [-13057, 1485, -406, 900, -593], [-2026, 1168, 908, 458, -151], [28326, 1388, 330, -20, -146], [-11125, -1403, 1056, -799, 1401], [-13736, -3280, 987, -742, 2], [8732, -1488, 172, -1464, 490], [14855, -1517, -815, 1801, -762], [-1008, -2146, 764, -296, -610], [-10750, 2448, -651, -1132, 585], [-6183, -659, -1727, -1060, 1159], [-16173, -851, 571, -62, 64], [-3985, -1093, -1033, 2172, -1179], [23878, -2906, -1046, -1804, -1198], [13902, 172, 40, 2348, 36], [17094, 196, 1788, -1084, 1576], [-5288, -2054, 186, 661, 784], [-1038, 4914, -239, 1922, -196], [8794, -1074, -1769, 2395, -2125], [7724, -2082, 996, 1262, 1355], [-20039, 359, 1069, -258, 372], [-7031, -1509, 1408, -1095, 1279], [11942, 2572, 502, -398, -61], [-6488, 716, 2396, 460, 1078], [-3798, -360, -134, 378, -1934], [-1963, -4097, 860, -2355, -441], [31570, 132, 852, -434, 368], [14818, -2024, 2561, -1072, 1073], [-6778, 1764, 2132, -431, 2216], [518, 774, -1298, 396, -902], [-21348, 2134, -518, -208, 272], [-19972, -2294, -2031, 860, 9], [-21644, 3314, -1196, 1368, -58], [-14414, -850, 2136, -56, 962], [-757, -219, -1628, 600, 529], [1734, 3240, 882, -2162, 1365], [-9436, 4254, 824, -400, 694], [-11294, 1748, 98, -1010, -1051], [-10133, -3503, -1428, 1196, -110], [14770, -372, 1020, -2168, 936], [-10473, -1851, -474, -1127, 1995], [2194, 1998, 2030, -3340, 3028], [13566, -1128, 1414, -2661, -270], [-17589, -55, -798, -400, 1371], [15657, -2677, -65, 422, 814], [2295, 2113, -1206, 332, 427], [28196, 1054, 1221, -2732, 123], [23570, 3266, -2007, 449, -1891], [19701, -265, 1228, -1284, -494], [36412, 252, -915, -154, 654], [-28812, 1650, 2006, 934, -112], [-17801, -1083, -1547, 1002, 1038], [-20768, 1190, 752, -2208, 806], [26932, 7618, -1856, 3462, -1442], [6176, 1802, 264, -392, 1954], [30594, -4218, 663, -963, 2979], [-17448, 196, -3550, 3600, -2466], [-8505, -1707, -2498, -710, -149], [-7556, 4394, 2549, -1212, 369], [6299, -3487, -30, -2726, 431], [-8851, -8873, 810, -2450, -55], [4695, -2091, -2127, 2970, -2550], [-3858, -6520, -1046, -221, -370], [6930, -1364, 722, 574, 385], [-4888, -188, -410, 3544, -2164], [17239, 2125, -698, 3295, -2813], [5046, -306, -145, -1354, 1024], [-27309, 5481, 1908, 990, 489], [6754, -2268, 2352, -424, 188], [915, -5561, 1359, 300, 3193], [-34266, 162, -1233, 1706, 510], [-14999, -3133, -4083, 910, 516], [-11553, -971, -1222, -3255, -97], [-5548, -3108, -1576, 4156, -2848], [25254, 4724, -16, 3206, -720], [-9416, 1640, 3044, -1976, 1388], [3572, -2714, -3060, 3372, -3142], [-12701, -3755, 792, -692, 2117], [-44384, -1182, 1537, -928, -1001], [15826, 4704, 764, -2008, 936], [-2276, -3034, -3798, 146, -989], [3664, 11448, 1842, -516, 1518], [39168, 2926, 2242, -2400, 1020], [59214, 4964, -2100, 1358, -864], [-28837, 1001, -1085, 2682, -992], [-14952, -2150, 1852, -2930, 1279], [-17922, 5648, 799, -2156, 2255], [13528, 186, 4108, -1102, 1050], [16314, 1670, -1176, 500, -562], [-39435, -1221, -3473, 1694, -882], [-32282, -3208, -438, 566, -1142], [23424, 2840, 2836, 1108, -2158], [-17161, 2409, -283, -4606, 3786], [-5559, 3135, -1540, 1496, -349], [-24749, 1341, -816, -3150, -483], [23384, 2318, -2275, 2668, 151], [-4185, 5607, -609, 3992, 1015], [27064, -380, 1249, 1082, -1876], [25916, -5832, -2098, -1844, -1548], [13136, 7908, -2772, 5680, -1886], [-7574, -880, 1350, 2938, -2222], [8134, 10268, 44, 1516, 952], [-19896, -188, 3888, -5672, 2734], [-5136, 3834, 3223, 1492, 847], [-31208, 586, 989, 2000, -3595], [41712, -1288, -3712, 1140, -822], [-9282, -44, 868, 278, -3009], [4203, 2593, -214, 2004, 567], [629, -69, 3922, -6249, 3965], [13989, 9333, -3627, 2824, 2245], [-41534, -6160, -2580, 3690, -1512], [-42537, -2079, 608, -102, 1813], [-30268, 3308, -942, 3928, 2], [-49853, 953, 4342, -1514, 3271], [32007, 2137, -1512, -2768, -1284], [12204, 3310, -680, -852, -3594], [-6736, -7528, -279, -43, 1259], [15507, -8631, 551, -3326, 788], [-35290, -5434, 3765, -694, 248], [-25156, 5590, 3108, -3888, 4002], [15615, 7009, 3392, 940, 61], [-18093, -3919, 456, 180, -4231], [42386, -8154, 2635, 2794, 930], [7354, 2068, 2664, -1938, 4360], [-10123, -1821, -3260, 3036, -3577], [62155, 4189, -9, -766, 1732], [16632, -558, 3146, 349, 1336], [-7341, -6045, -4361, 685, -2800], [65696, -2640, -1996, -896, 1034], [12540, 8524, 3821, -5879, 5675], [-60159, -3449, -2649, 2998, -134], [-6880, -1498, -2268, 4838, -3842], [-13463, -815, 343, 4252, -3723], [-62933, 11033, 3617, 2362, 2174], [36468, -1374, 4384, -4541, -1198], [-35526, -17956, 718, -2786, 1574], [-29054, 432, 1095, 3752, -3871], [-54828, -948, 1870, -240, -4848], [-21010, -2262, 1124, -176, 1788], [588, 14328, -2322, -608, -1838], [13090, -18636, -432, -2116, -3196], [-5131, 8551, 4359, -594, 1318], [-22289, -4335, 3397, -1310, 4330], [-28619, 7575, -5470, 1172, 73], [7447, 2213, 674, 6310, -17], [-36184, -15942, 1169, -5348, 2383], [48104, -13588, 783, -231, -431], [-12900, -7762, 3374, 723, 2392], [-24312, -3230, 601, -5368, -391], [20528, -732, -8925, 2461, -2643], [-2475, 3283, -1286, 7028, 2476], [38590, -4688, -2508, -2352, 3908], [33791, 14271, -405, -1461, -3624], [-13724, 2434, -6670, 4302, -1631], [10739, 4299, 2295, 7489, -160], [-26658, 4708, 4421, 3392, 1869], [23115, 2173, 1547, 210, -1496], [43211, 10569, 6520, -5324, 1229], [-48782, -8252, 1884, -1048, -8], [60383, 4133, -3073, 9482, -5280], [1456, -12752, -4919, -3314, 3538], [-26009, 3705, 3767, 1458, -2288], [-29423, 14735, -294, -2163, 4649], [-50931, -14749, 3452, -8360, 1912], [69317, 6469, 3003, -5401, 2638], [24918, 12636, 2355, 112, 2379], [746, 12, -6990, 4027, -3982], [8970, 2080, -4939, 3972, 2859], [35003, -11231, -3758, -2950, 1935], [24918, -868, -1084, 6364, 2184], [57936, -8174, 1761, -1412, 501], [-1398, 7716, -3643, 5588, -7059], [-43396, 1880, 2371, -1793, -3327], [-7671, 5327, -2683, 10046, -7460], [40758, -15042, -838, 3572, -6014], [-25483, -7297, 7444, -8851, 2767], [27195, -2971, -3946, 2524, -2149], [-69987, 3, -3426, 5164, 1620], [91871, 2357, -462, -1331, -2065], [-61162, 14888, -2492, 1000, -4668], [44061, -13631, 507, -5712, 5431], [-38280, 12700, -393, 1167, -6679], [-47253, -3759, 404, -9626, 3129], [33920, -9048, -16, 2360, -5874], [44776, 7480, -3254, 3152, -1698], [6724, 3374, -3474, 10914, -1645], [-1106, 816, -986, 521, 4626], [23294, -2696, -2728, 5506, -4988], [-3635, -15079, 4245, -4501, 4104], [27948, -10664, 3922, -5228, 5686], [-33765, 1105, -3371, -7750, -2], [-17322, 11534, -3165, -1266, 2336], [-8856, 9920, -5982, 1184, -2566], [3450, 2980, -2608, 8336, 4348], [58752, -930, -1740, -760, -5938], [-7314, 2672, 4226, -5340, 2598], [22214, 3558, -2812, 872, -3738], [-57129, -9083, 2266, -6404, -2021], [107116, 4066, 6144, -3400, -318], [7569, -7229, 2948, -3644, 7171], [34882, 16590, 3846, -2184, 2176], [18240, -15086, 2036, -2524, 534], [-24840, -12276, 7251, -4578, 3408], [-75249, -8531, 806, -4628, -4909], [53703, -3947, -1947, 2, -2494], [34048, 806, -2440, 9450, -4431], [-17292, -17334, -1254, 4916, -3900], [46236, -7038, -4125, 4676, -3681], [2996, 8218, 280, 2256, 4122], [3194, 14592, -1998, 6664, -4722], [-51840, 802, 607, 6456, -7509], [83373, -4981, 582, -4688, 3105], [-16763, 3959, -1238, 9092, 4733], [-44735, -19631, 2055, -8420, 3181], [-46806, -2724, 10087, 296, 8667], [-28803, 15051, 888, -5872, 1083], [59716, 8108, 2910, 6676, -2532], [-30208, -7394, 2196, -3685, 3170], [-64254, 19774, 1303, -1007, 4683], [79766, -3408, -9330, 6390, -7603], [60974, -7930, 1524, 6552, -6264], [10296, -9792, -1759, -8098, 2542], [-57307, 6615, -5718, 6294, -2983], [47776, -11890, -394, -3274, -4292], [139568, -3936, 4486, -2140, 164], [-38922, 21208, -4406, -1236, -6522], [87965, -8417, 2614, -272, 2950], [-74954, -4154, 4968, -5076, 1316], [-6022, -3848, -7501, 3380, -2225], [39558, -504, -10160, 3484, -8216], [-65630, 7408, -2847, 896, -749], [-5316, -14970, -3290, 4809, -1104], [-26369, -17359, 1579, -4958, 6020], [-35851, -13027, -1919, -720, 661], [-90167, 20215, 3024, 2876, 3943], [20279, -17091, 9722, -2993, -4713], [52511, 2361, 9784, -3163, 4245], [25496, 8942, 2574, -1806, 3392], [-42363, 4435, 5702, -747, -1183], [23772, -398, -5534, 7214, -5863], [-24811, 14915, 2644, -6316, 4323], [-67102, -36, -4905, -1696, 4403], [-28976, -2310, -3483, -128, -8853], [-56051, -9457, 4093, -8002, 2376], [-113739, 7237, -5753, -7237, 2410], [32065, 19331, -6974, 1000, -2090], [-44527, -3713, 11131, -6466, 9862], [56140, 20966, -1026, 2368, 1940], [-65425, -3669, -10243, 5485, 162], [-72633, 23409, 2032, 4824, -2824], [-43760, -704, 4455, 7506, 7802], [46621, -251, -4741, -828, 3129], [53091, 15745, 1774, -4283, -6353], [-82830, 2302, -3786, 9424, -1084], [63072, -7658, 7072, -7470, 4178], [-80204, -1808, -6182, -1880, -508], [-28610, -6572, -1654, -2388, -10178], [153384, 7386, 4732, -6872, 1734], [-105472, 9530, -2238, -3080, 4088], [11251, 21, -2563, -13382, 46], [53390, -4614, -209, 8045, -4625], [-69021, 8879, -3127, 1555, -950], [39244, -5774, 7633, 2788, 5049], [65178, -18864, 6520, -1807, 4456], [-43401, 12937, -2474, -7868, 4899], [-102852, 4908, 857, -5778, 7222], [-103718, -4810, 4024, -9680, 5094], [-29762, -1836, -13756, 7124, -8896], [-56639, 12005, 2153, 3793, 8304], [40400, 11414, -271, -2348, -6393], [-43946, -4396, -2545, 9152, -5755], [-11493, 6209, -968, -5162, -1955], [-18464, -6190, -12056, 7524, -1122], [63569, 4877, 8103, -288, -753], [-58894, 22, -1612, 1584, 1300], [-8964, -6218, 7590, -2230, -1456], [-70946, -5368, -4346, 6622, -11727], [-56582, 16140, 5652, -1668, -2000], [-38678, 1876, 17736, -8124, 10528], [253823, -1873, 1729, 2644, -1557], [-49744, -23076, 6161, -5750, -1224], [-102860, -15644, -7111, 10147, -2545], [51126, 12328, -2726, 6197, 9942], [82724, 6306, 4695, -1980, 4243], [86012, -3658, 2690, -3874, 1956], [-13414, 17520, 3735, -2396, -6447], [18753, -17615, -3063, 6400, 457]]
