
# q-expansion of newform 570.6.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 = 570
weight = 6
poly_data = [-35506440, -3172892, -39154, -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], [[6141876, -164020, -1173, 7], 49776], [[-1142260, -55307, -187, 2], 2074], [[15263364, 377988, 323, -9], 16592]]

hecke_ring_character_values = None
aps_data = [[-4, 0, 0, 0], [9, 0, 0, 0], [25, 0, 0, 0], [67, 1, 0, 0], [84, -1, 1, 0], [326, 0, -1, 1], [135, 0, 1, 2], [361, 0, 0, 0], [-24, 1, 4, -5], [1254, 21, -1, 4], [1243, 16, -5, 2], [2006, 10, -1, -9], [695, -48, -8, -9], [6340, 44, -7, 3], [2504, -81, -4, 5], [-66, -115, 20, -25], [7419, -3, -11, 35], [6830, -43, -22, -19], [6492, -100, 28, -16], [-6704, 60, -62, -38], [-15268, -120, 78, -48], [8733, 49, -15, -35], [-12103, -124, -9, 116], [-9587, 344, 0, 9], [11446, -434, 79, -25], [-33380, -218, 32, -28], [-45308, -476, 52, 68], [-11898, -112, -290, 0], [-36457, 91, 147, -211], [-17650, 249, 34, 81], [124208, 14, -300, 46], [16604, -137, 261, -36], [56823, 171, -35, 47], [27700, -890, 122, -272], [-45244, 50, 178, 118], [186013, -990, 349, -444], [315081, -1, 201, 153], [72346, -1574, 391, -175], [136534, 433, -572, 393], [137630, 1297, -98, -247], [-191607, -1727, -9, -313], [195415, -2223, -617, 819], [298122, 2127, 709, 122], [444348, 3790, -1017, -479], [270706, 1805, -780, 279], [379842, 1556, -1320, 162], [427710, -3410, -138, 346], [476610, 2302, -982, 134], [157406, -487, 1468, -1163], [213344, 1181, 2148, -239], [326461, -3191, 1759, -1143], [-266250, 3967, -827, 1174], [635434, -2224, -476, 220], [-60806, -1773, -235, -606], [-816544, -2441, 648, 267], [954780, 821, -266, 345], [-808698, -5551, -1743, -218], [853238, 194, 756, 4], [118089, -1457, 551, -3589], [322139, -48, -2668, 1751], [163824, 5218, 713, 65], [-250992, -3891, 484, -2131], [-430088, -12506, 754, 1004], [-444450, -1403, -2301, 1250], [844024, -5538, 2080, 1236], [-482164, 537, -1714, 995], [472582, 10443, 770, 1685], [-1097552, -3100, 1975, -1505], [-726933, -2940, 1209, 528], [-25458, 16662, -1544, 1306], [344731, 2305, 4301, 485], [-2165538, 5587, -1111, -1482], [-121127, -4425, 2102, -1858], [231672, 9004, 4049, -3247], [-1384648, 7829, 672, 307], [379924, 1634, 2328, 1770], [-1306436, -17296, -3850, -812], [-1426597, 16215, -5763, 1875], [-2317667, -7566, 1208, -2769], [-2837578, -22682, 2538, 788], [-1058890, 11477, -1625, 3970], [-1495217, 15301, -2639, -3187], [-1586532, -1980, -6326, -4690], [1255300, -13770, -6697, 2033], [-889739, 4881, -375, 469], [1733955, 24078, -3789, -1380], [-3547009, -15850, 2888, 5313], [2166494, -8990, 4750, -9188], [-1396910, -16722, 3136, 7270], [-1426173, -23963, -4752, -524], [-251503, 2038, -8847, 6792], [-467406, 16887, -4209, -1032], [-275324, -28700, 4966, 6002], [700032, 29463, 2227, -2566], [-578812, 37634, -4558, -1804], [3524418, -18777, -340, -221], [690682, 13343, 15349, 464], [-304195, 35292, 3202, -3261], [1993968, -40582, 1450, -448], [1529050, -30944, 9836, 4168], [-1701356, -34722, -6506, 1716], [-654322, 7908, -2008, -16084], [5868, 11207, -10950, -7229], [66211, -21426, 14788, 6337], [741044, 380, 5926, -2034], [978586, -7080, 1150, 4458], [-1840509, 9000, 10419, -798], [1427747, -30639, -7575, 18649], [-2722334, -2012, -4102, -3472], [-461018, 52196, 7034, 4950], [1417972, 22702, -5206, -8876], [4867275, -42005, -5581, 1577], [-764575, 12662, -9173, -20552], [886272, -13216, -13706, -6586], [-1032736, -28752, 6432, -3816], [-199893, -26338, -6922, 10799], [6713696, 1980, 8331, -3555], [221066, -31929, -1860, 15619], [-1261116, 353, 3950, -5881], [-7564851, -285, 5589, 11091], [-2443645, -31867, -7341, -22001], [1341770, 8200, -7171, -21213], [741864, 31347, -20010, 2301], [1594128, 32818, 11116, 8686], [-6808312, 12680, -1242, 14902], [-2529178, 18480, 11940, 4372], [-318156, 16155, -18268, 1863], [526738, -12903, -9939, 3560], [-3695115, -4743, -14856, 1766], [-1804361, 48425, -21479, 21433], [-11402692, -23556, 868, 18584], [-11179256, -4014, 14188, -6422], [-8465881, 19894, 19367, 12084], [3587339, 104465, -5125, -25909], [-6758328, 23078, -11694, -4814], [2186916, -46622, -2426, 23646], [5872210, 103935, -464, 9109], [-1534584, 22994, -26966, -21928], [-1303240, -46829, -17428, 30007], [-4379644, -36284, -2722, -28796], [-15785910, -10034, -4966, 1610], [-7824256, 113000, -2988, -18094], [4350759, -20409, -8068, 2442], [1682188, -91419, 13230, -36103], [-11974401, 44253, 13819, -49373], [5830156, -58384, -50670, 21066], [-447255, 64343, -25859, 18029], [-11608204, 63401, -7622, -8165], [-8498852, -98406, 2376, 27958], [7611440, 31778, 53312, -4218], [8831480, 55532, 48655, 20835], [-1182218, 98518, -2646, -22292], [11885588, 71564, 27825, -7469], [-551440, -16852, 45940, 3040], [-4554608, 94764, -34226, 12498], [-11347918, -177816, -8602, 1952], [8698248, -9866, 20436, 13774], [-25549026, -10284, -37458, -19110], [-4963158, -68274, 14358, 61460], [-18314856, -121905, 46691, -1940], [-400299, -163650, -27577, 25774], [8456568, 34275, -5904, -28185], [-14264445, -101087, 11054, 722], [-5804487, 48559, 7421, -12789], [-10498248, 51775, 378, -11839], [11729438, -3069, 7136, 32555], [7068875, -47629, -45421, -29173], [-8747667, 119131, -10579, 7805], [-1077278, -45594, -56168, 30930], [-190890, 237356, -21284, 14880], [8151001, 67665, -2001, -23857], [-14341357, 2993, -64243, 21041], [22482402, -9283, 10029, 45460], [-598476, -75474, 18126, 17666], [-17383713, -43525, 9303, -9669], [-20329936, -50094, 5288, -33280], [-4729752, -167436, -38758, -2010], [-2994854, -19302, 40214, 50316], [-10177998, 76464, 20956, -72110], [12103966, 173226, 37512, -20234], [-8892709, -154979, 19530, -41974], [3292299, 43701, -55365, -1515], [-12926034, 74220, 23193, -36397], [7044924, -256495, 44664, -11963], [-2516692, -101549, 52704, 18393], [8159460, -25140, -17874, -888], [-31735436, 99598, -72599, 13787], [12566700, -58070, 20666, -30628], [1693006, -218828, -10646, 52166], [22932878, 15429, 33435, 6346], [-1634586, 47094, -26233, 5823], [-28438599, -52658, -60319, 20664], [18176890, -5222, 66098, 78046], [-2048392, -158003, -85653, 31638], [-20299323, -106326, -81623, 25424], [2645618, 154301, -31158, 11177], [-16696710, 173855, -1510, -38957], [-15447559, -365327, 46943, 26121], [-10146707, 90468, -132165, -5962], [43671468, 111593, 27380, -35257], [-57838076, -49255, 11187, 10758], [17835619, 92603, -62861, -87125], [-38109250, 62344, 38437, 53179], [-68800332, -125390, -44662, -34990], [9591288, -237617, 98821, -59792], [-28593238, -115123, 10692, 109343], [-12075878, -269534, -52502, -47446], [564940, -41219, 31994, -131107], [-31624006, -361076, 15578, 19138], [-10719638, 45346, 33538, 38558], [-16211912, -401444, -37712, 4502], [-17745510, 321906, 77306, -12560], [-35034299, -391021, 136122, 20234], [-22845014, 168353, 456, -52971], [40814442, -195972, 22916, 73654], [-24148016, -269330, -21224, -71140], [-33257933, -95535, 79396, -68508], [20334809, -322232, -51606, -34917], [20966002, 149153, -28812, -95019], [83330680, 61177, -74494, 22559], [-24557947, 140797, 128343, -83815], [14851651, -150002, -16957, 17884], [38764103, -269846, -30558, -87909], [51898399, 157059, -88054, -26944], [68630954, -161763, 22920, 88009], [-11381906, -154834, -95536, -33198], [30282484, 355333, 58800, 19777], [19338564, 230304, 104778, -25110], [16123628, -259364, -66360, 96272], [68801812, 39991, 83513, 28280], [-11133155, -95963, 135537, -56457], [-11774398, 103153, 191746, -58877], [111844621, 131325, -28763, -25803], [11105273, 327268, 114388, 68477], [20758790, -328582, 55245, 98695], [72075256, -152709, -31772, -28127], [-29366462, -3371, -30066, 97449], [31258346, 229630, 27912, -37266], [51468394, 221961, -102281, 34570], [23073820, -668374, -108246, 73752], [-42967300, 278858, -117496, 2742], [65072076, -137948, 129488, 53636], [62515005, -29947, -95894, -32080], [-45812855, 225719, -234903, 100193], [-16257526, -359373, -93788, -9543], [44991362, -335121, -4097, 7776], [-36865547, 949, -219164, 23222], [-20629075, 99383, -188011, -23001], [-81854412, -237773, 59684, -42643], [15250056, 278865, -227686, 56797], [-70357913, -19787, -40565, 10787], [119821870, -362344, 28656, -57828], [68575462, 150669, -105860, -129767], [-96755124, 127714, 8924, -31744], [29158830, -372009, -109964, 165377], [55553750, -739355, -42751, 2608], [-2618638, -453737, 137698, -12065], [14376588, 228898, 180468, 15586], [-7311760, -580491, -10294, -152617], [101483636, 460170, 91870, 67166], [-37708862, 135498, -55946, 121518], [9761702, -230338, 100742, 127650], [6225096, 341644, -161686, 104], [-29532740, 299764, -59889, 99495], [55026067, 467382, 165033, -78136], [10923962, 53101, 261886, -111893], [4507012, -258135, -91885, 162822], [21635678, 693520, -52070, -79510], [72115016, 761596, -67504, -104472], [-40759376, -526843, 172462, -52921], [1256935, 102549, -156603, -85775], [24756148, 641912, -288668, -44588], [92531624, -246304, 23532, -260906], [5994218, -124260, -168156, 169590], [10835864, 207052, 215523, 68531], [108379529, -112481, 70936, 178060], [23810515, 255874, -186879, 206962], [7022565, 695189, 3749, -37853], [56230342, -442078, 318754, -108968], [-94969648, -257275, -52405, -3300], [-105119948, 169750, 13136, 152606], [-38804992, -881062, -72516, 91114], [-32669398, -59437, 325858, -127367], [14430623, -1271983, -83491, 61757], [140380194, -536784, -75475, 79221], [-56352454, 279701, -306653, 8350], [-14872786, 633808, -39092, -27944], [22112114, 342269, -462964, 15651], [-45663736, -215232, 83928, -108504], [1274485, 24668, 180206, -171641], [-38027326, 530358, 368750, -145000], [81508221, -274748, 93075, 2468], [-82193306, -41103, 301372, -9257], [-13658639, -950459, -305973, 11383], [-51966492, -171916, 80833, -72523], [-13284094, 585730, -298182, 38112], [16976489, 79557, 107541, 378777], [-107323750, 287341, -186244, 119143], [-25930091, 1322693, -161219, 130985], [-28864860, -441600, 10951, -92183], [111992688, -551680, 227330, 3760], [18976774, -27651, -430860, 289175], [-35926368, -276358, -185724, 318210], [-69533444, 466889, -60350, -57271], [211488956, 634902, -176810, -56068], [8474862, -1260738, 200317, 32761], [-193953714, -486798, -63570, -14730], [-81009363, -155635, 219199, 31073], [-117145710, 1470021, -219473, 172034], [-47832841, 1084897, -165625, 9939], [-141006162, 692059, 105410, 33141], [24242906, 741732, 57816, -341744], [-106336183, -667494, -410808, -49829], [14162552, 552502, -654234, 111992], [-100563744, 1635569, -114830, 59397], [43196584, 1380162, 131566, -163998], [-221718526, -184223, -235281, 22938], [-58591130, -592350, 308506, -232682], [49840512, 1034808, -443632, -8142], [92393640, 1184046, -41690, -268066], [111675428, 968875, -150096, -80839], [-89919652, -643370, 65212, 289492], [-138520830, -275085, 126065, -40904], [-46211816, -566450, 338134, -162940], [-298386413, 358640, 15165, -47550], [-57949542, 842544, -119640, 170648], [-204136234, -89554, -355594, -159766], [119164812, 426842, 148402, 26012], [-120000830, 1565111, 349612, -255337], [-147576092, 427335, -13374, 466829], [98851328, -998724, 482602, -367768], [-185328922, -234491, -284972, 101663], [-43095640, -1069508, 255246, 166478], [-105269811, 1746498, -20677, -90770], [68026604, 521754, 268038, 132336], [-110487315, 1647384, 96999, -189324], [-118153979, -1590567, 174635, 272105], [-79621068, 1779655, -54850, 59001], [-22307400, -340139, -172320, -239399], [160344827, 1225623, -394500, -57570], [-175029684, -847428, -208573, -46173], [127456513, -178165, 41159, 39643], [-5739822, 1066389, 338121, -53946], [123004781, -1498038, 458457, -278040], [-44920900, 953679, -184278, -488015], [-8663521, -1085013, -176341, 23027], [72576598, 647629, 689374, 39185], [54680152, 43738, 590416, -132574], [-58173160, 68650, -8544, 234414], [-167183912, -1166184, -119510, -187484], [277882214, -1347769, -287762, 210861], [-47116852, -172604, 23771, -364353], [-59769152, -106872, -201316, 314226], [112591212, -1147146, -605338, 396840], [-249050017, -180567, -233409, 46803], [125830176, 1610639, 292502, 73013], [174190578, -339969, -241297, 117352], [320873816, -1093215, 147437, -142978], [-213574083, -883076, -308953, 15690], [-227770652, 92842, 195508, -330018], [37070757, -135987, 359387, 77781], [149893180, -740120, -173362, -214504], [-84660960, 1563938, -211660, -108910], [89192289, -622749, -203345, 69485], [109387920, -1703464, 263405, -139073], [-21051678, 2071564, 22151, -71515], [-8218972, -657090, -438454, -283342], [-172370436, -834588, 283234, 442510], [-184785160, -302790, 330584, -207704], [30592492, 1503765, -20063, 161698], [-13330640, -602208, 258156, -110552], [-187422990, -1493993, 226280, 172263], [410774318, 59045, -250439, 5194], [146855678, 125368, 159658, -231152], [-109156087, 933485, 598341, -56345], [-11516637, -668625, 233227, -64141], [-27727138, -1600923, 137835, -171014], [169608558, -845372, 227192, -382360], [17456018, -930352, 596462, -125958], [-167240946, -522122, -50415, -163979], [98373012, 1066391, -695461, 16496], [188736687, -2377614, 102789, -437892], [-121917823, 272177, -564396, 183670], [-334229399, 97473, 6427, 447121], [346846544, 713107, -586264, 44349], [-101776022, 656141, -460080, 572133], [137149250, 2950772, -216304, -431374], [434195729, -838045, -93897, -6641], [130628694, 88952, 100601, 91453], [-22778090, 1484409, -687064, 318789], [-199841500, 876042, 720636, -505272], [-118452160, 1733447, -716582, 99805], [182524694, -1873971, 770111, -429334], [144236518, 2933380, -146987, -195859], [-233914270, 1468658, -53964, -394240], [183630668, 657292, -171123, 489677], [-206811375, 560514, -569155, 114960], [168656205, -1215742, 303074, -161059], [-83691452, 1413501, 44904, -244433], [235781448, 2458944, 443754, 308244], [-148093237, 363999, 626833, -639553], [274333071, -199878, 227149, -595372], [70533150, -31374, 128300, 201012], [-66263608, 855947, -42500, -556013], [137356702, -685105, 308671, -665638], [74290450, -3023576, 477498, -146868], [-106518667, -598729, -671811, -49391], [135005255, 342270, 195372, -802163], [354531164, 1371138, 157722, 133092], [11132672, 3182975, 187113, -17644], [-12386982, 1169304, 39227, -471075], [-265309344, 613823, -15562, 124829], [17704628, 150108, 993212, -451936], [-114549584, -1297224, 246170, 247178], [262192656, 228852, 9062, 358008], [116604836, 1269754, -256706, 352010], [75028318, 1037278, 173538, -879662], [303769178, 291870, 824982, 15354], [292791859, -342983, 145769, 493481], [-189620240, 861534, -594788, -264266], [-14051676, 3225905, -12735, -397952], [9010308, 1201160, -372873, -218085], [-161614992, 472153, 443948, 207003], [-52285835, -856803, 706001, -552291], [46913654, -323048, -506231, -111941], [-78899852, 838831, -335812, 269807], [-82480678, -1808680, -866470, -133584], [630487342, 352368, 349972, 366664], [28887108, -1970424, -650862, 400574], [-377640738, 346953, -340181, -616498]]
