
# q-expansion of newform 75.9.c.f, downloaded from the LMFDB on 19 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 = 75
weight = 9
poly_data = [105274575720, 0, 10575941812, 0, 148116566, 0, 776307, 0, 1634, 0, 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, 0, 0, 0, 0, 0], 1], [[420291052310412, 0, 46859095322612, 0, 444620825535, 0, 1265751468, 0, 872557, 0], 157481360352], [[0, 3248388872882004, 0, 435449159046332, 0, 4207972253529, 0, 12128076852, 0, 8400715], 153386844982848], [[8500823024651488512, -333149360354096228, 838390872436304960, -7688439646206644, 8070520521247776, -45386771554953, 23429801734080, -95509278940, 16283051488, -57764587], 818063173241856], [[-3166797504195456336, -302148258954712068, -294739647408790352, -25589598548147796, -2784656217757620, -239395694736177, -7973245106928, -683931862716, -5511595228, -472531299], 2454189519725568], [[-78686308946433819024, 1406792850841336212, -7306496448374739344, 114013619651256356, -68650021977427524, 1062323361567957, -195884281212336, 3031560854316, -135239021452, 2093833615], 2454189519725568], [[2376421310019837708, -79972255476863300, 232437279369669340, -11263359272015892, 2222840829944163, -111468906693249, 6426141790740, -326570626108, 4459205273, -227599251], 204515793310464], [[-6149466470074792824, 2502732354612363948, -470492136055365208, 126525776892571548, -4181709941725758, 1168104544393851, -11462785669512, 3397055634708, -7788738074, 2367048033], 1227094759862784], [[-2305416434330119500, -1081393765837086024, -244869910854985916, -101849890279564424, -2330474252110563, -968434359217698, -6744083301684, -2788945929432, -4685079769, -1932377350], 613547379931392], [[744725103888164832, 2509334301004612548, 53505191980737856, 197852659386244756, 485940762965256, 1824598860588897, 1377320091264, 5148112932156, 949770776, 3538913459], 613547379931392]]

hecke_ring_character_values = [[26, [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [52, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]]
aps_data = [[0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [2, 0, -1, 0, -1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-204, -5, -5, 0, -12, 0, -1, 0, 1, 0], [27, -3, 227, 1, 62, -3, 0, 1, 2, -5], [1782, 55, 55, -9, 133, 14, -9, 0, 0, 0], [65, 0, -1146, 31, 119, -12, -45, 11, -3, 11], [-14219, -7, 103, 51, 274, 83, 69, 0, -18, 0], [-30, -15, 3399, 74, -2, -6, -90, -13, -29, -43], [-2242, -33, -13887, -42, -4446, 102, -198, 61, -179, -5], [-300298, 1371, 579, -102, 1322, -236, 47, 0, -149, 0], [-305580, 2860, -4160, 654, -10012, -794, 532, 0, 122, 0], [-1817, -252, -73222, 569, -2897, -42, -945, 19, -357, -485], [-1165014, 5535, 6475, -1170, 15408, 510, -781, 0, -389, 0], [12930, 210, -74702, -730, 25378, -552, 2250, -148, 1372, 272], [-16110, -945, 205525, -750, -29856, 564, -900, 471, -1179, -1419], [-35864, 174, -112314, -2384, -69742, 3474, 2214, -2508, -2678, -2160], [149352, -21081, 3551, -753, 9273, 4506, -2297, 0, 1544, 0], [1601149, 685, -28425, 12243, -64192, 7897, 10745, 0, 1498, 0], [42754, -1491, -851161, 4522, 92384, -2496, -180, -2403, 1939, -5385], [5296635, 32675, 48955, 18639, 125393, 20866, 31267, 0, -12628, 0], [847336, 98948, -41072, 8376, -97546, -3242, 6484, 0, 1892, 0], [56115, 3150, 946122, 17685, 102372, -4623, -18630, 408, -537, 6708], [201699, 4851, -626361, 3729, 389847, -10464, 14031, -1002, 16758, 8700], [40438498, 158945, 139485, -24933, 330143, 1828, -12727, 0, -12206, 0], [239900, 6195, -2037055, 36840, 452700, -20130, -34740, 8515, 10615, 20905], [616214, 272920, -40840, -102, -91302, 33672, -21800, 0, 21698, 0], [-93485, -12285, -33467, -36559, -163370, 729, 27720, 13255, 4416, -11315], [106288656, -25709, -210685, -22245, -532455, -111810, -33005, 0, 10760, 0], [-85005, 14835, -2510381, 8945, -205775, 11910, -10755, -8740, -10550, 20930], [108151942, 467070, -547830, 23646, -1307812, 11254, -76234, 0, 99880, 0], [411496, 14061, 11738191, 29188, 807596, -12474, 22140, -26787, 24541, 1335], [890865, 13305, 7025409, 97883, 1692943, -80130, -93285, 48872, 53470, 75482], [131935131, 70086, 278120, -16635, 692690, 142645, -28050, 0, 11415, 0], [-1060270, -12390, -3465810, 12630, -2098740, 50910, -124560, 15370, -96560, -9410], [-12919808, -1463091, -493019, -87768, -1244632, -219164, -151367, 0, 63599, 0], [540042246, 518785, -739835, 185655, -1733737, 23680, 139609, 0, 46046, 0], [363107947, -1085935, 1689735, -423399, 3983708, 65119, -365539, 0, -57860, 0], [2658650, -44685, 27086105, 88570, 5419856, -192924, 86940, 31499, 207009, -57871], [-2264300, 40515, -6065459, -200448, -4430778, 259020, 261450, -219367, -158365, -138337], [1188073, 23772, 3215208, 167383, 2433554, -29583, -1728, -128724, 36931, -81180], [-117496118, -1825321, -2291789, 379917, -5469867, -227784, 240623, 0, 139294, 0], [3391338, -2097, -39641567, 21834, 6540558, -304962, 51030, 248409, 321273, 244215], [38963101, -1937830, -1105770, 105840, -2837242, -1022810, 357314, 0, -251474, 0], [-724150, 175410, 10436042, -251474, -1683814, 243480, 535770, -290716, -6420, 60104], [197539636, 3842511, -1315325, 546000, -3070090, -112550, 655555, 0, -109555, 0], [-499818493, 4299211, -4516671, -371127, -11027468, -566161, -1270673, 0, 899546, 0], [-735373060, 1993905, -1698355, -835596, -4227682, 77446, -1707603, 0, 872007, 0], [3259060, -283905, 33802125, 909776, 7420168, -361518, -888840, -50333, -29397, -618143], [584631816, -4764459, -4519975, 1485375, -10370465, 902000, 1111805, 0, 373570, 0], [-5493540, 422535, -24140775, -494488, -12289082, 491436, 164250, 34397, -295841, 879467], [9319714, 84771, -76769631, 1120274, 18760132, -500664, -324504, -375017, 420753, -205475], [864670047, -3908734, -6566026, -19212, -16167058, -2023766, -534438, 0, 515226, 0], [4657705, 214500, -69401600, 412855, 9046130, -105375, 207360, -374220, 245995, 54780], [1138180, 458670, 6670114, -195740, 871772, 79212, 361260, 28578, 194098, 945918], [-2373790, -266685, -78405995, 72354, -4074558, 378, -432990, 127033, -233603, -406337], [-11793988, -440187, -97049693, -2071248, -22686114, 635568, 1305378, 418699, -347171, -461675], [2205694002, 1863626, 7902254, 1977798, 19950392, 2947114, 3566082, 0, -1588284, 0], [-3062007558, -13275825, -15856985, -222789, -38768227, -3334526, -2194049, 0, 1971260, 0], [-4307244, 376671, 27371241, 1448048, -8597774, 665976, -1262610, -1146727, -961289, -393385], [1285922693, -17474225, 12471965, -1630953, 30055318, 2243963, -1012717, 0, -618236, 0], [-7468820, -249330, -180935018, 813804, -13627830, 501606, -1255050, -561820, -1003066, -1060480], [-6156539559, 16749895, 5373565, -1798485, 12949678, 2064095, -2628501, 0, 830016, 0], [-7336228, -1302558, -43456198, -251604, -13552578, -1069878, -2850750, 2787796, -314558, 182680], [-5273445258, 13306205, 12134185, 842931, 30140943, 4251564, 2074901, 0, -1231970, 0], [8164120, -86250, 466173042, 2329008, 16697400, -734148, -2269800, -110410, -51202, -282910], [1107579307, 22687534, 28211056, -3473343, 66896518, -576739, 315558, 0, -3788901, 0], [-152383065, -27323410, 16768390, 3969114, 42577658, 7698496, 6624862, 0, -2655748, 0], [-58612455, 1132980, 92929828, -2321225, -121365592, 3748683, -2687310, 741742, -4266793, 3007702], [4821999216, 6030916, 17829800, -3103350, 43578880, 7040150, -4215460, 0, 1112110, 0], [34434420, 1474905, -242476569, 4951304, 67518106, -908508, -715770, -3073981, 1161553, -124171], [34347036, 1204779, 353247081, 2418296, 65059108, -1959066, -117396, 20627, 2321527, 2430185], [-7893328236, 20752605, 39173425, -3032712, 93852038, 2211802, 2097625, 0, -5130337, 0], [-2948646630, 17193805, -7602815, 4675599, -17996777, -3425704, 7330677, 0, -2655078, 0], [-3509491959, 12763617, -73775161, 10973643, -175151778, -1430601, 3375037, 0, 7598606, 0], [30886460, 1863270, -468900682, -3510596, 54452774, -1568310, 5954490, 1730336, 4174230, 5456876], [746374, -1066449, -815626811, -5197506, 4073952, -624, 6336756, 618143, 1757393, -1514755], [-702208872, 21774255, 17064595, -7587903, 37067253, -11850972, -3987337, 0, -3600566, 0], [-53079305, -9990, -885899000, -2365855, -106743335, 3144600, -2095155, 614695, -3846315, 594715], [9873479701, -12459542, 19290058, 2477286, 47466434, 3374188, 6471994, 0, -3994708, 0], [-7187833, 2203473, -726775053, -3912843, -18162204, 2694003, 7165818, -2823881, 429094, 1583065], [-8818737428, -66535626, 54248086, -1451358, 132472838, 12838516, 3392038, 0, -4843396, 0], [-70917664, 340641, -512339869, -13247492, -142560184, 5952666, 11558160, -297067, -1986399, 384215], [-71059597, -50087320, 20420300, -10956738, 46246308, -2855322, -12304592, 0, 1347854, 0], [19269123966, 91386597, 63167009, -10645542, 150142692, 3354894, -5741423, 0, -4904119, 0], [27873475, 2446020, 783229696, 6958685, 57454858, 1985943, 1375020, -9045968, -712263, -4153928], [-115463145, -4740975, 1632904025, 4356165, -218530125, 4132860, -17844165, 1826760, -11661240, -7655190], [563047271, 44399105, -104983795, 17430675, -247291377, 5917980, 4525129, 0, 12905546, 0], [-93205868, -879183, -1577506313, -2862424, -184482938, 5269032, -5112630, 708751, -7266303, -1049615], [-13551156248, -14631510, -67882230, 13584816, -162315272, -10574416, 12389026, 0, 1195790, 0], [14280600, -943935, -1838759245, 9510500, 33532216, -1355694, -9495360, -2139211, -2124071, -4027081], [53559938, -2333598, -1113913522, 26291478, 114100644, -6938298, -30226608, 20026, -3915104, -4647170], [9684982250, 101922645, 35907245, -929346, 87543038, 7757596, 2591457, 0, -3520803, 0], [62685388, -4247382, 970373738, -6222756, 143003178, -2190882, 17832150, -4890256, 6719138, -13385020], [39893030226, -64359167, -35298067, -3781614, -84532076, 4698038, -14989411, 0, 11207797, 0], [78624180, -296775, 2381051303, 4051512, 154404210, -6726612, -1737450, 3734475, 6048537, 3140925], [-197139234, 7414824, -445199164, -11452894, -409455242, 18034884, 4435974, -7067698, -14084618, 7761950], [-7408391, 4732824, 2580784154, 16033207, -31541311, -1098606, -23824575, 2526057, -5265311, 11991705], [-25676468825, 172424905, 47223975, 2457969, 111926928, -9511029, 17181957, 0, -14723988, 0], [-7010431068, 74485681, 35363669, -11546097, 82383167, -902096, -11040183, 0, -505914, 0], [-11619354437, -124374580, 149565330, -18352923, 354941308, -1724497, 1238188, 0, -19591111, 0], [259188950, -8330370, -2019994654, 14497218, 538141536, -21554562, -1420380, 5227474, 18304312, -11433266], [281419720, 8652195, -149224535, 31866284, 554183392, -10634562, -1570680, -17300537, 12995067, 3853], [-14778373, 4238118, -305510848, -30687203, -30991849, 10370478, 49513023, -11279251, 7546569, -2803015], [10266097242, -245883675, -332415895, 79674210, -780659440, 6019330, 58587825, 0, 21086385, 0], [-10714984433, -73193570, 12401430, 24803646, 39013798, 21448184, 33586846, 0, -8783200, 0], [-72676135, -8845155, 438219671, 5314291, -143068468, -8937639, -35365050, 24251663, -5799096, 6561353], [-397503215, 12686250, 2385298896, -24282185, -838732207, 27637038, -7189695, 5667027, -25804853, 31039527], [601548560, 2795970, 2045819130, 65431800, 1197927150, -40935690, -30519270, -3217940, 31694590, 2374000], [-21153803443, 142558396, 20532624, 7187838, 48635212, -10403266, 19768372, 0, -12580534, 0], [-129172892404, 174228690, -200866150, 67792260, -463845872, 23372180, 58945514, 0, 8846746, 0], [-28181031798, -377295500, 26389540, -18959424, 68810008, 46334984, -43591164, 0, 24631740, 0], [128552400, 20827455, 904035849, 34503316, 205227194, -1128732, -23741010, -10604759, 157547, 31050151], [14776794206, -67106879, -497832315, 14629170, -1205855960, -69921190, -48191315, 0, 62820485, 0], [-24715735998, 379750235, -246462325, -37997850, -610308310, -55995800, -87690705, 0, 49692855, 0], [-129431252, -6674652, -3875387132, -55682236, -246968612, 8853648, 54710460, 8130064, 7158288, -5219240], [-69255295174, 420590800, 281345240, -23886030, 685079398, 73140140, -11204656, 0, -12681374, 0], [-119306220, 2003610, -7723921370, -1826332, -219190028, 18294684, 14449140, -25433242, -12810434, -21426022], [-396105640, 2949240, 4445020, 5394360, -794215506, 26351034, -35878230, -6843494, -37327364, -945014], [526389851, -17700591, -1222444649, 53783441, 1125410098, -34456431, -8547876, -19528623, 25706942, -54929805], [10181145202, -58546214, -138951026, 53715588, -306197178, 82710834, 25070402, 0, 28645186, 0], [-191701412590, -258491220, 489322460, -45728736, 1168841448, 18066456, 17471932, 0, -63200668, 0], [783560360, 9008205, 5086459811, 24533540, 1571616370, -33349680, 65008710, -31520265, 58021985, -13503855], [-211850515, -22500030, 11639597558, -49388341, -360701756, 9801255, 41379390, 4500816, -3508135, -40499244], [-55445776283, -411396484, -470372906, 234903, -1158189368, -146706871, -35015988, 0, 35250891, 0], [27965590, -20690145, 1245295025, 18750590, 117163450, -10281450, -24306030, 838165, -4717275, -40542125], [143578542316, -412001167, 753683173, -105819009, 1797155239, 47397128, -37532631, 0, -68286378, 0], [400805912, 12926463, 12093628157, 14705612, 759699256, -22795122, 13897728, 3133179, 31736519, 28986105], [-20995555518, -294611445, 456602335, -88207734, 1091803408, 67996754, -77010609, 0, -11197125, 0], [-43485934342, 130278930, 476655710, -115454148, 1105790378, -75462482, -59210502, 0, -56243646, 0], [69698480786, -321668764, -545288100, 60937350, -1306629750, -50628900, 8693700, 0, 52243650, 0], [798745970, -20926470, 2899190214, 52851782, 1653515404, -62139618, -6665400, 6755946, 52942328, -35096994], [122194684722, -360605016, -97911064, -146096958, -261287622, 14591616, -259173992, 0, 113077034, 0], [51675503836, 174541935, -207646245, 122438085, -464631307, 46160320, 135907559, 0, -13469474, 0], [-757002883, 27794097, -3618748423, -71839409, -1564428673, 74727522, 59003955, -32959384, -45794838, 22628810], [-81758612949, 1098430598, 866363018, -150796044, 2073752374, 123201698, -117281746, 0, -33514298, 0], [-465490870, -15484995, 8917446563, -101473550, -903369274, 27006786, 75693870, 18842519, -6937161, -12127471], [73039177730, 33682835, 209039255, -189410946, 487445868, 118169226, -308517353, 0, 119106407, 0], [-525028230, -58379280, 4831019132, -19841914, -946656434, -13491120, -86796810, 71737814, -34900910, -45020746], [-720955924, -33788361, 1456436121, -75883624, -1459117442, -7424316, -69788286, 118570677, -27101233, 50993955], [-215749112258, 238343329, -590983019, 266290182, -1358647652, 32267786, 294960573, 0, -28670391, 0], [-705533886, 4509624, -935919876, 52136702, -1435967846, 32012364, -141025590, 11371202, -77517686, 20390450], [318602606220, 417875905, -331686755, 26910684, -831906682, -206203034, 59200957, 0, -32290273, 0], [-1481596075, -15705825, -5957786139, -147986865, -2936697240, 91451925, 46015650, 20622565, -81348650, -10789085], [-137046252034, 1041663618, 420638238, -163154304, 1016570654, 198348718, -256258726, 0, 93104422, 0], [1204466664, 23757711, -5809362071, -15305876, 2390948402, -40120524, 174950766, -53288207, 106356683, -5772785], [-301132431426, 29717485, -378922775, 203210283, -860777937, 39973332, 233362565, 0, -30152282, 0], [747684515, 54467475, 16696643859, -107521855, 1301192497, -27983658, 184330845, 30774108, 107583098, 139709058], [165491020581, -569492298, -194778556, 44632503, -471055398, -62566821, 57483022, 0, -12850519, 0], [2409895370, 53496060, 955080592, 350344502, 4723192786, -140933676, -191532870, -63890226, 94921406, 43101894], [159775702292, 134131855, -1144756405, 221256261, -2725658147, -112470136, 170046791, 0, 51209470, 0], [-1936365564, 63370566, 2390457386, -12238332, -4006557444, 157158396, -101266740, -56285382, -169790454, 70455750], [113470741423, 523213035, 11638365, -104754183, 54681258, 238500093, -260679057, 0, 155924874, 0], [-207763400, 68235060, 17751935812, 39317080, -462132196, 92764884, 73144260, -158099784, -45638444, -21629664], [140488025626, 1265397000, 329358960, -73173810, 808639738, 164064980, -116832296, 0, 43658486, 0], [-60391068, -102721938, -8078161078, -11482204, 51978832, -81064008, -115648920, 135404846, 8273722, -70039030], [-183115181574, 226841511, -528519985, 58233330, -1318070790, -306347460, 110008315, 0, -51774985, 0], [-2942292452, -36275913, -19925817607, -111542872, -5759905586, 182056452, -100130958, -15851579, -227525409, -88403405], [-30073033415, 1926843730, -1578896730, 256274304, -3690783022, 236571346, -368998, 0, 256643302, 0], [-1167872062, 373728, -5935364592, -92230866, -2303816892, 93267138, 48205080, -33048416, -77074202, -32300960], [-2943676440, 14598465, -22386427533, -33389804, -6022268824, 143859090, -295085520, 91120549, -237354775, 120317479], [-110892055, 83408205, -12371484939, 100241139, -539815629, -8658678, -197379945, 67806904, -29331902, 234623314], [467364328144, -771130590, 1499914050, 379762488, 3758895408, 415745952, 741304410, 0, -361541922, 0], [-303332541, 18049944, -9252812136, -49196323, -500191316, 95078829, 181136610, -160623598, -28683311, -124523710], [1382506115, -78396615, 7826349105, 164672281, 2998551323, -124434648, -102030885, 1650752, 64292148, -155142478], [-1715336740, 23585910, 9181741382, -69004900, -3279533258, 207327162, 137156490, -221897952, -153746362, -174726132], [530538895272, 88136909, 1833173141, 15623352, 4481662288, 394610396, 233787833, 0, -218164481, 0], [-512875846652, 1284195170, 1861263330, -220987638, 4447728558, 124470468, -31115742, 0, -189871896, 0]]
