
# q-expansion of newform 270.3.g.c, downloaded from the LMFDB on 20 June 2026.

# 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 = 270
weight = 3
poly_data = [9, 0, 0, 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, 1, 0, 0], 1], [[0, 0, 1, 0], 3], [[0, 0, 0, 1], 3]]

hecke_ring_character_values = [[191, [1, 0, 0, 0]], [217, [0, 0, -1, 0]]]
aps_data = [[1, 0, -1, 0], [0, 0, 0, 0], [-3, 2, 1, 1], [-1, 0, 1, 4], [-10, -2, 0, 2], [-9, -2, -9, 0], [-13, 0, 13, 1], [0, 1, -13, 1], [-4, 21, -4, 0], [0, 11, 4, 11], [31, 11, 0, -11], [27, 0, -27, 12], [14, -10, 0, 10], [24, -22, 24, 0], [-12, 0, 12, 12], [7, 3, 7, 0], [0, -9, -38, -9], [-63, -16, 0, 16], [5, 0, -5, 42], [10, -20, 0, 20], [-14, 70, -14, 0], [0, -47, -3, -47], [42, -19, 42, 0], [0, -12, 74, -12], [-18, 0, 18, 88], [52, -50, 0, 50], [-38, 40, -38, 0], [98, 0, -98, 26], [0, 12, -77, 12], [-98, 8, -98, 0], [-13, 0, 13, 10], [32, 37, 0, -37], [-57, 0, 57, 67], [0, -38, 130, -38], [0, -34, -90, -34], [58, 76, 0, -76], [-102, 0, 102, 42], [143, 46, 143, 0], [-86, 0, 86, 49], [-61, 83, -61, 0], [0, -4, 164, -4], [-79, -8, 0, 8], [-116, -9, 0, 9], [-135, 10, -135, 0], [-27, 0, 27, 61], [0, -44, 150, -44], [-13, 29, 0, -29], [57, 82, 57, 0], [-2, 0, 2, 23], [0, 66, 33, 66], [84, -94, 84, 0], [0, -39, -264, -39], [-317, 48, 0, -48], [-264, 26, 0, -26], [-107, 0, 107, 135], [52, -126, 52, 0], [0, -153, 58, -153], [75, -105, 0, 105], [360, 0, -360, 14], [432, 13, 0, -13], [140, -26, 140, 0], [75, 159, 75, 0], [-117, 0, 117, -174], [538, -11, 0, 11], [6, 88, 6, 0], [153, 0, -153, 55], [190, -40, 0, 40], [-15, 0, 15, -106], [32, 0, -32, -10], [0, -126, -271, -126], [60, 116, 60, 0], [0, -9, 140, -9], [65, 0, -65, -124], [-218, -144, -218, 0], [0, 39, -31, 39], [-240, -89, -240, 0], [0, 186, -42, 186], [37, 0, -37, -194], [-42, -259, 0, 259], [0, 214, 213, 214], [0, -32, 174, -32], [47, -266, 0, 266], [-154, 183, 0, -183], [269, 82, 269, 0], [0, 187, 265, 187], [-504, 25, -504, 0], [0, 195, 136, 195], [-216, 0, 216, -276], [-274, -3, 0, 3], [251, -6, 251, 0], [158, 0, -158, 393], [0, -18, 190, -18], [72, 0, -72, 138], [-56, -25, 0, 25], [0, 119, -29, 119], [312, 171, 312, 0], [0, 186, -224, 186], [-438, -134, 0, 134], [-297, 80, -297, 0], [580, -110, 0, 110], [-30, 0, 30, 134], [-120, 0, 120, -184], [42, -78, 42, 0], [0, 41, -760, 41], [11, 55, 0, -55], [-320, 0, 320, -306], [-102, 0, 102, -435], [-61, -29, -61, 0], [0, 35, 514, 35], [71, 36, 0, -36], [-204, 0, 204, 354], [450, 16, 450, 0], [165, 0, -165, 149], [0, -30, 636, -30], [415, 115, 0, -115], [568, -24, 0, 24], [-339, 28, -339, 0], [64, 0, -64, -163], [39, -443, 39, 0], [0, -213, -286, -213], [536, 222, 0, -222], [-563, -10, -563, 0], [146, 0, -146, -296], [24, -413, 24, 0], [-453, -187, 0, 187], [2, -77, 0, 77], [0, 162, 464, 162], [0, -105, -932, -105], [384, 0, -384, -136], [214, -104, 214, 0], [0, 83, -125, 83], [244, -290, 244, 0], [-807, 177, 0, -177], [567, 0, -567, 372], [296, -77, 0, 77], [0, 90, 547, 90], [-51, -85, -51, 0], [-92, 0, 92, 590], [-531, 0, 531, -181], [0, -94, 410, -94], [194, -88, 0, 88], [290, -31, 0, 31], [602, 78, 602, 0], [138, 0, -138, 119], [0, -476, -260, -476], [0, -300, 212, -300], [-104, 392, -104, 0], [-177, 0, 177, 355], [0, -85, 55, -85], [-658, -77, -658, 0], [318, 0, -318, 238], [-28, 73, 0, -73], [-161, -100, -161, 0], [6, 0, -6, -91], [388, 0, -388, 312], [-698, 201, 0, -201], [0, -150, 922, -150], [0, 308, 622, 308], [-452, 0, 452, -188], [-1038, 205, 0, -205], [-122, 0, 122, 177], [-798, -152, -798, 0], [469, 0, -469, 6], [628, -365, 0, 365], [-60, 0, 60, -496], [250, -739, 250, 0], [967, -285, 0, 285], [826, 0, -826, -26]]
