
# q-expansion of newform 63.6.e.f, 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 = 63
weight = 6
poly_data = [18380851776, 0, 1297462320, 0, 66232188, 0, 1518438, 0, 25399, 0, 187, 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, 0, 0], 1], [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1], [[120250595793888, 0, 19861967445084, 0, 387910489914, 0, 7616751407, 0, 56078291, 0, 334805, 0], 268837476625872], [[0, -389088072419760, 0, -19861967445084, 0, -387910489914, 0, -7616751407, 0, -56078291, 0, -334805], 268837476625872], [[0, 10371144626826480, 0, 529420847226732, 0, 16589437928838, 0, 203024549011, 0, 1494767143, 0, 4837597], 537674953251744], [[-465300162504, 0, 2005169040, 0, 102358836, 0, 5331481, 0, 39253, 0, 289, 0], 11897569332], [[-15147397403237232, 0, -474402432194820, 0, -12528900245394, 0, -579963031, 0, 247743581, 0, 8147771, 0], 268837476625872], [[0, 6931671291720, 0, -176101022160, 0, -8989514244, 0, -404606113, 0, -3447337, 0, -25381], 999395823888], [[8984729705580720, 0, 458647852670748, 0, 10868775058206, 0, 175884221279, 0, 1294946627, 0, 7113833, 0], 134418738312936], [[663388031086704, 0, 44932220248548, 0, 1451072814470, 0, 23947312631, 0, 185645795, 0, 901281, 0], 9956943578736], [[0, -37967330091600, 0, 260318121840, 0, 13288585356, 0, 628528315, 0, 5095963, 0, 37519], 499697911944], [[0, -6214938283940400, 0, -317256967300860, 0, -7874821552212, 0, -121663045655, 0, -895743515, 0, -4460963], 44806246104312]]

hecke_ring_character_values = [[29, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [10, [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]]
aps_data = [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, -2, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0], [13, 0, 6, 0, 0, -1, 2, 0, 2, 3, 0, 0], [0, 0, 0, -24, -3, 0, 0, 0, 0, 0, 0, 2], [41, 0, -13, 0, 0, -7, -26, 0, 0, -13, 0, 0], [0, 0, 0, -76, 10, 0, 0, 0, 0, 0, 0, 0], [1568, 0, 1568, 0, 0, 0, 1, 0, -7, -1, 0, 0], [0, -64, 0, 0, 0, 0, 0, 22, 0, 0, 4, 0], [0, -250, 0, -250, 61, 0, 0, -61, 0, 0, 8, -8], [-18, 0, -3839, 0, 0, 140, 18, 0, 140, 36, 0, 0], [-3060, 0, -3060, 0, 0, 0, -133, 0, -89, 133, 0, 0], [0, 184, 0, 184, 104, 0, 0, -104, 0, 0, -56, 56], [-7459, 0, 189, 0, 0, -33, 378, 0, 0, 189, 0, 0], [0, 312, 0, 0, 0, 0, 0, -68, 0, 0, 56, 0], [0, 0, 0, 1202, 175, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -4440, -83, 0, 0, 0, 0, 0, 0, -70], [-2576, 0, -2576, 0, 0, 0, -274, 0, 350, 274, 0, 0], [-119, 0, -23885, 0, 0, 313, 119, 0, 313, 238, 0, 0], [0, -3336, 0, -3336, -264, 0, 0, 264, 0, 0, 48, -48], [259, 0, 16457, 0, 0, 119, -259, 0, 119, -518, 0, 0], [16761, 0, 16761, 0, 0, 0, -812, 0, -714, 812, 0, 0], [0, 4312, 0, 4312, 567, 0, 0, -567, 0, 0, -14, 14], [0, -492, 0, 0, 0, 0, 0, -190, 0, 0, -112, 0], [-72898, 0, 7, 0, 0, 2149, 14, 0, 0, 7, 0, 0], [0, 0, 0, 4124, 290, 0, 0, 0, 0, 0, 0, -336], [24458, 0, 24458, 0, 0, 0, -181, 0, 735, 181, 0, 0], [0, -2184, 0, 0, 0, 0, 0, 1901, 0, 0, -166, 0], [-2177, 0, -39007, 0, 0, -1717, 2177, 0, -1717, 4354, 0, 0], [0, -3000, 0, -3000, -248, 0, 0, 248, 0, 0, 96, -96], [-19963, 0, -2744, 0, 0, 190, -5488, 0, 0, -2744, 0, 0], [0, 11752, 0, 0, 0, 0, 0, 479, 0, 0, -378, 0], [0, 0, 0, -26828, -614, 0, 0, 0, 0, 0, 0, 568], [-148063, 0, 2071, 0, 0, 4249, 4142, 0, 0, 2071, 0, 0], [0, 31700, 0, 0, 0, 0, 0, -2030, 0, 0, 448, 0], [5089, 0, -53268, 0, 0, -5541, -5089, 0, -5541, -10178, 0, 0], [634, 0, -35522, 0, 0, -10430, -634, 0, -10430, -1268, 0, 0], [38378, 0, 38378, 0, 0, 0, -3374, 0, 7526, 3374, 0, 0], [0, -19128, 0, -19128, 2074, 0, 0, -2074, 0, 0, 924, -924], [0, 59524, 0, 0, 0, 0, 0, -3726, 0, 0, 1176, 0], [0, 0, 0, -14160, 3284, 0, 0, 0, 0, 0, 0, -976], [-208951, 0, -3583, 0, 0, -6181, -7166, 0, 0, -3583, 0, 0], [0, -17632, 0, 0, 0, 0, 0, 932, 0, 0, -2096, 0], [854, 0, -253337, 0, 0, -11346, -854, 0, -11346, -1708, 0, 0], [0, 1492, 0, 1492, -4778, 0, 0, 4778, 0, 0, 856, -856], [6172, 0, -62284, 0, 0, 8876, -6172, 0, 8876, -12344, 0, 0], [217328, 0, 6776, 0, 0, -1408, 13552, 0, 0, 6776, 0, 0], [-156748, 0, -2173, 0, 0, 2303, -4346, 0, 0, -2173, 0, 0], [0, 0, 0, 34984, -14993, 0, 0, 0, 0, 0, 0, 406], [-591514, 0, -591514, 0, 0, 0, 9263, 0, -7077, -9263, 0, 0], [0, -100484, 0, 0, 0, 0, 0, -8774, 0, 0, 1248, 0], [0, -110992, 0, -110992, -1314, 0, 0, 1314, 0, 0, 1028, -1028], [2083, 0, -755010, 0, 0, -3465, -2083, 0, -3465, -4166, 0, 0], [0, 50824, 0, 50824, -21065, 0, 0, 21065, 0, 0, 2002, -2002], [0, 45876, 0, 0, 0, 0, 0, 19410, 0, 0, -1960, 0], [0, 0, 0, -44688, 1416, 0, 0, 0, 0, 0, 0, 1520], [0, 0, 0, 42338, -449, 0, 0, 0, 0, 0, 0, -6216], [616763, 0, 616763, 0, 0, 0, -4625, 0, -5803, 4625, 0, 0], [-8631, 0, 1064337, 0, 0, -5915, 8631, 0, -5915, 17262, 0, 0], [0, -186612, 0, -186612, -8818, 0, 0, 8818, 0, 0, 48, -48], [3769, 0, 117793, 0, 0, 13741, -3769, 0, 13741, -7538, 0, 0], [0, 158422, 0, 158422, 10109, 0, 0, -10109, 0, 0, -1064, 1064], [-105301, 0, -36127, 0, 0, -3577, -72254, 0, 0, -36127, 0, 0], [0, 0, 0, -28872, -20228, 0, 0, 0, 0, 0, 0, 224], [43827, 0, 43827, 0, 0, 0, 2278, 0, -39858, -2278, 0, 0], [0, -130254, 0, 0, 0, 0, 0, -19847, 0, 0, 2456, 0], [1675566, 0, 1675566, 0, 0, 0, 3493, 0, 32865, -3493, 0, 0], [-646219, 0, 8960, 0, 0, 36944, 17920, 0, 0, 8960, 0, 0], [0, 0, 0, -219200, 5156, 0, 0, 0, 0, 0, 0, -656], [-937762, 0, 32984, 0, 0, -29344, 65968, 0, 0, 32984, 0, 0], [0, 0, 0, -66240, 26568, 0, 0, 0, 0, 0, 0, 9464], [0, 31976, 0, 0, 0, 0, 0, 25578, 0, 0, 4732, 0], [-40798, 0, -1348149, 0, 0, 77756, 40798, 0, 77756, 81596, 0, 0], [1284050, 0, 1284050, 0, 0, 0, -34363, 0, -46023, 34363, 0, 0], [917315, 0, 11179, 0, 0, 87841, 22358, 0, 0, 11179, 0, 0], [0, -86752, 0, 0, 0, 0, 0, -8558, 0, 0, -1652, 0], [0, 0, 0, -229628, -3818, 0, 0, 0, 0, 0, 0, 3208], [-1258362, 0, -1258362, 0, 0, 0, 617, 0, -34475, -617, 0, 0], [0, 215696, 0, 0, 0, 0, 0, -15560, 0, 0, -7976, 0], [-12922, 0, 281785, 0, 0, -60354, 12922, 0, -60354, 25844, 0, 0], [0, 13136, 0, 13136, -30732, 0, 0, 30732, 0, 0, -11032, 11032], [4325549, 0, 19761, 0, 0, -42933, 39522, 0, 0, 19761, 0, 0], [0, 0, 0, 334904, -50864, 0, 0, 0, 0, 0, 0, -2304], [550691, 0, 4493, 0, 0, 17927, 8986, 0, 0, 4493, 0, 0], [193067, 0, 193067, 0, 0, 0, -12897, 0, 87493, 12897, 0, 0], [0, 282648, 0, 0, 0, 0, 0, 12079, 0, 0, -11170, 0], [0, 545244, 0, 545244, -36630, 0, 0, 36630, 0, 0, 24, -24], [2501497, 0, 2501497, 0, 0, 0, -9310, 0, 64730, 9310, 0, 0], [0, -281940, 0, -281940, 34682, 0, 0, -34682, 0, 0, -3696, 3696], [-1126513, 0, -16681, 0, 0, -116083, -33362, 0, 0, -16681, 0, 0], [0, 252592, 0, 0, 0, 0, 0, 9844, 0, 0, 336, 0], [0, 0, 0, 401168, -33928, 0, 0, 0, 0, 0, 0, -14952], [-41818, 0, 1284959, 0, 0, -64976, 41818, 0, -64976, 83636, 0, 0], [0, -53000, 0, -53000, 73463, 0, 0, -73463, 0, 0, 18922, -18922], [2187516, 0, 2187516, 0, 0, 0, -77847, 0, -93151, 77847, 0, 0], [0, -485352, 0, -485352, -42378, 0, 0, 42378, 0, 0, 11340, -11340], [0, -750150, 0, 0, 0, 0, 0, -12027, 0, 0, 8288, 0], [0, 0, 0, -403024, 25000, 0, 0, 0, 0, 0, 0, 17136], [4005428, 0, 4005428, 0, 0, 0, 100447, 0, 29351, -100447, 0, 0], [91714, 0, 91714, 0, 0, 0, 69279, 0, -45405, -69279, 0, 0], [63416, 0, 51758, 0, 0, -119218, 103516, 0, 0, 51758, 0, 0], [0, 0, 0, 675142, 59541, 0, 0, 0, 0, 0, 0, 34408], [0, 0, 0, -1265800, -56019, 0, 0, 0, 0, 0, 0, 1050], [0, -97804, 0, 0, 0, 0, 0, -110002, 0, 0, 14824, 0], [-3451, 0, -2864855, 0, 0, -167175, 3451, 0, -167175, 6902, 0, 0], [47924, 0, -4980397, 0, 0, 92596, -47924, 0, 92596, -95848, 0, 0], [0, 839576, 0, 839576, 1045, 0, 0, -1045, 0, 0, -5698, 5698], [0, -534548, 0, 0, 0, 0, 0, 96166, 0, 0, -34944, 0], [0, 0, 0, -166872, 8314, 0, 0, 0, 0, 0, 0, 15644], [-5322481, 0, -176600, 0, 0, -148232, -353200, 0, 0, -176600, 0, 0], [4019267, 0, 4019267, 0, 0, 0, -66838, 0, -70560, 66838, 0, 0], [-50596, 0, 7034726, 0, 0, -100676, 50596, 0, -100676, 101192, 0, 0], [0, 856208, 0, 856208, 53340, 0, 0, -53340, 0, 0, 43064, -43064], [33111, 0, 1037511, 0, 0, -105749, -33111, 0, -105749, -66222, 0, 0], [6550748, 0, -109641, 0, 0, 89811, -219282, 0, 0, -109641, 0, 0], [0, 0, 0, -197072, 87844, 0, 0, 0, 0, 0, 0, -80], [-2580511, 0, 201939, 0, 0, 162477, 403878, 0, 0, 201939, 0, 0], [0, 0, 0, -1256376, 21260, 0, 0, 0, 0, 0, 0, -5152], [0, -382378, 0, 0, 0, 0, 0, -83165, 0, 0, -16568, 0], [0, 751408, 0, 751408, -68028, 0, 0, 68028, 0, 0, -9008, 9008], [-183389, 0, -6475361, 0, 0, -6377, 183389, 0, -6377, 366778, 0, 0], [5017163, 0, -241486, 0, 0, -140314, -482972, 0, 0, -241486, 0, 0], [0, -659946, 0, 0, 0, 0, 0, 36379, 0, 0, 58520, 0], [0, 0, 0, 1720952, -71549, 0, 0, 0, 0, 0, 0, 7062], [831054, 0, 831054, 0, 0, 0, 102037, 0, -245175, -102037, 0, 0], [0, 169782, 0, 169782, 17853, 0, 0, -17853, 0, 0, -20928, 20928], [668858, 0, 668858, 0, 0, 0, -134988, 0, 213700, 134988, 0, 0], [0, -1053008, 0, 0, 0, 0, 0, -162854, 0, 0, -29820, 0], [-2538457, 0, 237396, 0, 0, -38010, 474792, 0, 0, 237396, 0, 0], [-6961010, 0, -6961010, 0, 0, 0, -87785, 0, -333893, 87785, 0, 0], [-61061, 0, 11397965, 0, 0, 22523, 61061, 0, 22523, 122122, 0, 0], [0, 456920, 0, 456920, -187842, 0, 0, 187842, 0, 0, -18436, 18436], [196563, 0, 196563, 0, 0, 0, 124740, 0, -417334, -124740, 0, 0], [-11832886, 0, -115626, 0, 0, 282618, -231252, 0, 0, -115626, 0, 0], [0, -482740, 0, 0, 0, 0, 0, 7774, 0, 0, -39368, 0], [-5491153, 0, -181038, 0, 0, -123690, -362076, 0, 0, -181038, 0, 0], [0, 0, 0, 1488108, 39218, 0, 0, 0, 0, 0, 0, -10864], [-88784, 0, -18744296, 0, 0, 70504, 88784, 0, 70504, 177568, 0, 0], [0, 351714, 0, 351714, -237737, 0, 0, 237737, 0, 0, -40992, 40992], [0, 0, 0, 1481672, -115028, 0, 0, 0, 0, 0, 0, -13848], [-6269416, 0, -45438, 0, 0, -523950, -90876, 0, 0, -45438, 0, 0], [0, 1690330, 0, 0, 0, 0, 0, 14421, 0, 0, 23664, 0], [-42084, 0, 16281532, 0, 0, -386260, 42084, 0, -386260, 84168, 0, 0], [0, 1461336, 0, 1461336, 147591, 0, 0, -147591, 0, 0, -45246, 45246], [-4437, 0, -1576471, 0, 0, 234087, 4437, 0, 234087, 8874, 0, 0], [0, -1073320, 0, -1073320, 191518, 0, 0, -191518, 0, 0, 13580, -13580], [24764675, 0, 87453, 0, 0, -73521, 174906, 0, 0, 87453, 0, 0], [0, 0, 0, 235104, 107652, 0, 0, 0, 0, 0, 0, 5768], [5830832, 0, 5830832, 0, 0, 0, 268808, 0, -150696, -268808, 0, 0], [0, -58208, 0, 0, 0, 0, 0, -179834, 0, 0, -52740, 0], [9753828, 0, 9753828, 0, 0, 0, -117390, 0, -341302, 117390, 0, 0], [0, -2403012, 0, -2403012, 45918, 0, 0, -45918, 0, 0, -28560, 28560], [-14823385, 0, 197631, 0, 0, -157779, 395262, 0, 0, 197631, 0, 0], [0, -553248, 0, 0, 0, 0, 0, 170214, 0, 0, 73052, 0], [236257, 0, -924189, 0, 0, -350055, -236257, 0, -350055, -472514, 0, 0], [0, 312232, 0, 312232, -360120, 0, 0, 360120, 0, 0, 82816, -82816], [-7054046, 0, -7054046, 0, 0, 0, 214137, 0, 68877, -214137, 0, 0], [0, -2259920, 0, 0, 0, 0, 0, -37512, 0, 0, -114744, 0], [9827603, 0, 92440, 0, 0, -691208, 184880, 0, 0, 92440, 0, 0], [0, 0, 0, 1452502, 265397, 0, 0, 0, 0, 0, 0, -96656], [0, 1221712, 0, 0, 0, 0, 0, 296004, 0, 0, 83112, 0], [0, -1833400, 0, -1833400, 526940, 0, 0, -526940, 0, 0, -7816, 7816], [-10521877, 0, 644, 0, 0, 314318, 1288, 0, 0, 644, 0, 0], [0, 3754312, 0, 0, 0, 0, 0, 244441, 0, 0, -73374, 0], [0, 0, 0, 1301544, 103996, 0, 0, 0, 0, 0, 0, 69344], [0, 0, 0, -746504, -288080, 0, 0, 0, 0, 0, 0, 31024], [-459942, 0, -12309703, 0, 0, 588960, 459942, 0, 588960, 919884, 0, 0], [-449151, 0, 33295167, 0, 0, -150059, 449151, 0, -150059, 898302, 0, 0]]
