
# q-expansion of newform 1200.3.e.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 = 1200
weight = 3
poly_data = [121, 0, 11, 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], 1], [[0, 44, 0, 2], 11], [[11, 0, 2, 0], 11], [[0, 0, 0, -6], 11]]

hecke_ring_character_values = [[751, [-1, 0, 0, 0]], [901, [1, 0, 0, 0]], [401, [1, 0, 0, 0]], [577, [1, 0, 0, 0]]]
aps_data = [[0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [-12, 0, 0, -1], [0, -1, -1, 0], [0, 1, 12, 0], [-24, 0, 0, 1], [0, -1, -15, 0], [-22, 0, 0, 2], [-6, 0, 0, 3], [0, -1, 21, 0], [0, -4, 6, 0], [30, 0, 0, 3], [0, 4, -30, 0], [-37, 0, 0, -2], [0, -3, -43, 0], [0, 1, -6, 0], [70, 0, 0, -2], [0, 4, -28, 0], [0, 0, 42, 0], [-96, 0, 0, 0], [-35, 0, 0, -4], [-114, 0, 0, -1], [0, 2, -20, 0], [0, 11, 18, 0], [-95, 0, 0, 6], [108, 0, 0, -4], [0, 6, -48, 0], [0, 1, 102, 0], [-78, 0, 0, 6], [0, -10, -32, 0], [-42, 0, 0, -6], [0, -1, -97, 0], [-61, 0, 0, -6], [0, -3, -5, 0], [0, -7, 126, 0], [-96, 0, 0, -9], [0, 22, -42, 0], [-11, 0, 0, 12], [0, -21, -24, 0], [71, 0, 0, 10], [-222, 0, 0, 6], [0, 21, 19, 0], [0, 3, 43, 0], [0, 5, -39, 0], [0, 1, 138, 0], [13, 0, 0, -18], [-30, 0, 0, 11], [0, -19, -90, 0], [193, 0, 0, 0], [0, -2, 216, 0], [-72, 0, 0, -10], [0, 19, 54, 0], [204, 0, 0, 9], [0, 22, -136, 0], [181, 0, 0, 0], [0, 0, 0, 11], [0, 19, 99, 0], [-402, 0, 0, -4], [0, 31, -81, 0], [0, 34, -18, 0], [-421, 0, 0, -6], [-84, 0, 0, -14], [0, -22, 40, 0], [265, 0, 0, -18], [0, 0, 126, 0], [158, 0, 0, -4], [-96, 0, 0, 7], [0, 17, -78, 0], [0, -3, 163, 0], [215, 0, 0, 16], [0, 45, 113, 0], [0, 2, -168, 0], [414, 0, 0, 1], [431, 0, 0, 12], [-294, 0, 0, 21], [145, 0, 0, -30], [0, -3, 78, 0], [190, 0, 0, -2], [0, -31, 60, 0], [-37, 0, 0, -30], [0, -13, -15, 0], [0, -14, 60, 0], [744, 0, 0, 2], [-26, 0, 0, 0], [330, 0, 0, -7], [0, 14, -344, 0], [0, -35, 72, 0], [0, 36, -54, 0], [0, -9, -29, 0], [0, -48, 192, 0], [0, -11, 231, 0], [0, 3, -162, 0], [-318, 0, 0, -2], [-288, 0, 0, -25], [0, 5, -13, 0], [-23, 0, 0, 20], [0, 50, -20, 0], [-78, 0, 0, -4], [0, 23, 72, 0], [96, 0, 0, -9], [0, 59, 215, 0], [-265, 0, 0, 16], [0, 63, -30, 0], [246, 0, 0, -43], [0, 30, -216, 0], [47, 0, 0, 6], [0, 8, 124, 0], [590, 0, 0, -16], [18, 0, 0, -7], [0, 23, 35, 0], [0, -3, -139, 0], [-552, 0, 0, -22], [0, 6, 24, 0], [0, 8, -228, 0], [-702, 0, 0, -16], [0, -3, 426, 0], [-106, 0, 0, 8], [242, 0, 0, 38], [-612, 0, 0, 7], [0, 20, 504, 0], [0, -54, -396, 0], [612, 0, 0, 21], [-647, 0, 0, -10], [0, 5, 108, 0], [0, -55, -87, 0], [538, 0, 0, -12], [0, 24, -204, 0], [0, 16, 300, 0], [0, -74, 56, 0], [-239, 0, 0, 2], [12, 0, 0, 8], [-697, 0, 0, 6], [150, 0, 0, -39], [0, -31, 263, 0], [-432, 0, 0, 26], [-810, 0, 0, 11], [0, 13, 15, 0], [30, 0, 0, 28], [0, -15, 365, 0], [0, 7, -798, 0], [166, 0, 0, -20], [0, 65, -192, 0], [-337, 0, 0, -42], [336, 0, 0, -46], [0, 14, -500, 0], [0, -30, -276, 0], [-853, 0, 0, -2], [-756, 0, 0, 46], [0, -41, -383, 0], [0, 64, -558, 0], [0, 28, 212, 0], [0, -4, -270, 0], [0, 1, -909, 0], [12, 0, 0, 25], [455, 0, 0, -26], [918, 0, 0, 28], [0, 21, -276, 0], [792, 0, 0, -28], [0, 112, -172, 0], [0, -14, -630, 0], [-162, 0, 0, -14], [0, 80, 156, 0], [0, 25, 793, 0], [-1018, 0, 0, -12], [-167, 0, 0, -64], [-426, 0, 0, 46], [0, -9, -420, 0], [-817, 0, 0, 48], [0, 62, 318, 0], [-611, 0, 0, -34], [0, 51, 79, 0], [-156, 0, 0, 22], [0, -35, -213, 0], [792, 0, 0, 23], [0, 3, -247, 0], [83, 0, 0, 6], [0, -51, 857, 0], [0, 44, -480, 0], [589, 0, 0, 36], [1578, 0, 0, 12], [0, 0, -570, 0], [-90, 0, 0, 32], [-395, 0, 0, 12], [0, -51, 463, 0], [997, 0, 0, 38], [0, -79, 480, 0], [-779, 0, 0, 62], [0, -19, -126, 0], [0, -101, 265, 0], [360, 0, 0, -65], [0, 67, 660, 0], [366, 0, 0, -48], [434, 0, 0, 62], [-1502, 0, 0, 28], [1662, 0, 0, -2], [0, -69, 456, 0], [-342, 0, 0, 15], [0, 118, 68, 0], [2086, 0, 0, 4], [-242, 0, 0, 10], [0, 92, 684, 0], [-312, 0, 0, 49], [0, -91, 239, 0], [0, 17, -456, 0], [912, 0, 0, 2], [0, 171, -319, 0], [179, 0, 0, -96], [330, 0, 0, -76], [0, -3, 1121, 0], [0, 104, -324, 0], [0, -92, 30, 0], [842, 0, 0, 38], [0, 95, 369, 0], [768, 0, 0, 17], [0, -19, -102, 0], [-156, 0, 0, -75], [-155, 0, 0, -28], [0, 1, 39, 0], [978, 0, 0, 16], [0, 138, -120, 0], [0, 139, 390, 0], [671, 0, 0, 60], [1380, 0, 0, 19], [0, -14, 1242, 0], [0, -63, -725, 0], [0, 75, -684, 0], [-839, 0, 0, -64], [0, -114, 24, 0], [0, -29, 1359, 0], [30, 0, 0, 28], [0, -34, 1096, 0], [0, -20, 312, 0], [70, 0, 0, 58], [-1770, 0, 0, -9], [0, 60, -186, 0], [0, -73, -222, 0], [0, -99, -336, 0], [0, -111, -631, 0], [0, -163, 359, 0], [1163, 0, 0, -90], [-1650, 0, 0, 4], [0, 16, 186, 0], [0, -151, -169, 0], [0, -1, 204, 0], [0, 59, -1203, 0], [0, 128, 234, 0], [-470, 0, 0, 84], [-1236, 0, 0, 31], [0, -118, -648, 0], [-203, 0, 0, -42], [192, 0, 0, 29], [0, 212, 108, 0], [-335, 0, 0, 26], [0, 186, 336, 0], [954, 0, 0, 57], [1238, 0, 0, 48], [0, -143, 709, 0], [0, -171, 12, 0], [-62, 0, 0, 4], [563, 0, 0, -8], [-2190, 0, 0, 0], [0, -6, 1260, 0], [-1626, 0, 0, 50], [-1068, 0, 0, 38], [0, 96, -36, 0], [6, 0, 0, 14], [-205, 0, 0, 52], [0, -82, -236, 0], [-1862, 0, 0, 48], [0, -69, 77, 0], [-1679, 0, 0, 24], [0, 31, -1019, 0], [0, -156, 762, 0], [35, 0, 0, -60], [-1837, 0, 0, -42], [0, 38, -780, 0], [0, 11, 462, 0], [0, -36, 564, 0], [0, 131, -132, 0], [275, 0, 0, 90], [0, 123, -857, 0], [0, 128, 750, 0], [2833, 0, 0, 0], [-3366, 0, 0, -1], [0, -70, 112, 0], [-54, 0, 0, 147], [1470, 0, 0, 2], [0, 198, 768, 0], [984, 0, 0, -22], [0, 82, -36, 0], [2843, 0, 0, -6], [42, 0, 0, 47], [0, 163, -851, 0], [642, 0, 0, -53], [0, -129, -996, 0], [0, 28, 1052, 0], [-1114, 0, 0, -4], [-588, 0, 0, 32], [0, 17, -303, 0]]
