
# q-expansion of newform 1296.3.q.m, downloaded from the LMFDB on 18 January 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 = 1296
weight = 3
poly_data = [1, 0, 0, 0, -1, 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, 0, 0, 0, 0], 1], [[0, 0, 0, 0, 1, 0, 0, 0], 1], [[0, 0, 3, 0, 0, 0, 3, 0], 1], [[0, -1, 0, 1, 0, 2, 0, 1], 1], [[0, 0, 6, 0, 0, 0, -3, 0], 1], [[0, 1, 0, 2, 0, 1, 0, -1], 1], [[0, 1, 0, 5, 0, -5, 0, -1], 1], [[0, 4, 0, -4, 0, 1, 0, 5], 1]]

hecke_ring_character_values = [[1135, [1, 0, 0, 0, 0, 0, 0, 0]], [325, [1, 0, 0, 0, 0, 0, 0, 0]], [1217, [0, 1, 0, 0, 0, 0, 0, 0]]]
aps_data = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -1, 0], [-1, 1, 1, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, -3, 1, 1], [0, -11, -2, 0, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0, -1], [7, 0, 0, 0, -3, 0, 0, 0], [0, 0, 0, -13, 0, 13, -1, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, -16, 2, 0, 0, 0, 0, 0], [2, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, -13, 0, 13, -3, 0], [35, -35, 1, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 10, 8, 8], [0, 0, 0, 9, 0, 0, 0, 9], [0, 0, 0, 6, 0, -6, 4, 0], [-44, 44, 5, 0, -5, 0, 0, 0], [0, 29, -19, 0, 0, 0, 0, 0], [0, 0, 0, 13, 0, 0, 0, 7], [-16, 0, 0, 0, 9, 0, 0, 0], [-91, 91, 1, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 38, -6, -6], [0, 0, 0, -47, 0, 0, 0, 10], [-8, 8, -10, 0, 10, 0, 0, 0], [0, 0, 0, 0, 0, 17, 19, 19], [0, 56, 8, 0, 0, 0, 0, 0], [0, 0, 0, -36, 0, 0, 0, 18], [11, 0, 0, 0, 12, 0, 0, 0], [0, 0, 0, -54, 0, 54, -1, 0], [-101, 0, 0, 0, 15, 0, 0, 0], [0, 0, 0, -31, 0, 31, 17, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, -70, -34, 0, 0, 0, 0, 0], [0, 0, 0, -55, 0, 55, -24, 0], [80, -80, 4, 0, -4, 0, 0, 0], [0, -146, 7, 0, 0, 0, 0, 0], [124, 0, 0, 0, 6, 0, 0, 0], [0, 0, 0, -33, 0, 33, -29, 0], [0, 0, 0, 0, 0, 9, -4, -4], [0, 0, 0, -26, 0, 0, 0, -14], [74, 0, 0, 0, -6, 0, 0, 0], [0, 0, 0, 0, 0, 77, 15, 15], [0, 133, -26, 0, 0, 0, 0, 0], [0, 0, 0, 79, 0, 0, 0, -26], [52, 0, 0, 0, -48, 0, 0, 0], [0, 11, -7, 0, 0, 0, 0, 0], [53, -53, -35, 0, 35, 0, 0, 0], [0, 0, 0, 0, 0, -93, 19, 19], [0, 259, -20, 0, 0, 0, 0, 0], [0, 0, 0, 35, 0, 0, 0, -4], [0, 0, 0, -52, 0, 52, 20, 0], [64, -64, -37, 0, 37, 0, 0, 0], [0, 0, 0, -49, 0, 0, 0, -43], [0, 0, 0, 53, 0, -53, -24, 0], [0, 0, 0, 0, 0, 100, -10, -10], [0, 0, 0, -96, 0, 0, 0, 21], [295, 0, 0, 0, -27, 0, 0, 0], [-188, 188, -64, 0, 64, 0, 0, 0], [0, 0, 0, 0, 0, 60, -43, -43], [0, 254, 38, 0, 0, 0, 0, 0], [0, 0, 0, 34, 0, -34, 25, 0], [34, 0, 0, 0, 72, 0, 0, 0], [0, 0, 0, 94, 0, -94, -24, 0], [-35, 35, -10, 0, 10, 0, 0, 0], [0, 0, 0, 0, 0, -4, -11, -11], [-325, 325, 19, 0, -19, 0, 0, 0], [0, 286, 16, 0, 0, 0, 0, 0], [0, 0, 0, 149, 0, -149, -1, 0], [64, -64, -28, 0, 28, 0, 0, 0], [0, 0, 0, 0, 0, -173, 33, 33], [0, 0, 0, 59, 0, 0, 0, 11], [296, -296, -50, 0, 50, 0, 0, 0], [0, -92, -38, 0, 0, 0, 0, 0], [-92, 0, 0, 0, 42, 0, 0, 0], [0, 0, 0, 57, 0, -57, -65, 0], [0, 0, 0, 0, 0, -171, 5, 5], [-250, 0, 0, 0, -87, 0, 0, 0], [0, 0, 0, -197, 0, 197, 4, 0], [0, 232, 97, 0, 0, 0, 0, 0], [0, 0, 0, 22, 0, -22, 48, 0], [19, -19, -28, 0, 28, 0, 0, 0], [0, 0, 0, 162, 0, 0, 0, -54], [173, 0, 0, 0, -114, 0, 0, 0], [368, -368, -86, 0, 86, 0, 0, 0], [0, 0, 0, 0, 0, -78, 52, 52], [0, 0, 0, 53, 0, 0, 0, -67], [496, -496, 53, 0, -53, 0, 0, 0], [0, 0, 0, 0, 0, 79, 15, 15], [0, 92, 110, 0, 0, 0, 0, 0], [0, 0, 0, 26, 0, 0, 0, -94], [0, 0, 0, 0, 0, -29, -13, -13], [-38, 0, 0, 0, -84, 0, 0, 0], [0, 0, 0, -51, 0, 51, 97, 0], [0, 137, -19, 0, 0, 0, 0, 0], [0, 0, 0, 100, 0, 0, 0, 58], [0, 0, 0, 133, 0, -133, 7, 0], [0, 0, 0, 199, 0, 0, 0, -5], [493, 0, 0, 0, -9, 0, 0, 0], [281, 0, 0, 0, -24, 0, 0, 0], [-496, 496, 22, 0, -22, 0, 0, 0], [0, 0, 0, 59, 0, 0, 0, 38], [0, 0, 0, 80, 0, -80, -22, 0], [0, 0, 0, 0, 0, 232, -75, -75], [0, 362, -52, 0, 0, 0, 0, 0], [263, 0, 0, 0, 90, 0, 0, 0], [0, 0, 0, 0, 0, -149, -61, -61], [0, 0, 0, -273, 0, 0, 0, -66], [0, 0, 0, -246, 0, 246, -68, 0], [-647, 647, -28, 0, 28, 0, 0, 0], [0, 551, 29, 0, 0, 0, 0, 0], [-232, 0, 0, 0, 90, 0, 0, 0], [0, 0, 0, 37, 0, -37, -122, 0], [62, -62, -32, 0, 32, 0, 0, 0], [-56, 0, 0, 0, 168, 0, 0, 0], [0, 0, 0, 0, 0, 47, -50, -50], [0, -52, -100, 0, 0, 0, 0, 0], [0, 0, 0, 93, 0, 0, 0, -141], [0, 0, 0, -141, 0, 141, 77, 0], [0, 0, 0, 0, 0, -57, 109, 109], [0, 646, -35, 0, 0, 0, 0, 0], [-881, 881, -46, 0, 46, 0, 0, 0], [0, 0, 0, 0, 0, 115, -57, -57], [0, 0, 0, -280, 0, 0, 0, 86], [845, -845, -17, 0, 17, 0, 0, 0], [0, 0, 0, -90, 0, 0, 0, -9], [-269, 269, -28, 0, 28, 0, 0, 0], [0, 0, 0, 49, 0, 0, 0, 97], [35, -35, 49, 0, -49, 0, 0, 0], [0, 178, -38, 0, 0, 0, 0, 0], [-164, 0, 0, 0, 24, 0, 0, 0], [0, 0, 0, -392, 0, 392, -132, 0], [0, -907, -43, 0, 0, 0, 0, 0], [-52, 0, 0, 0, 108, 0, 0, 0], [0, 0, 0, 33, 0, -33, 2, 0], [0, 367, 34, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, 0, 0, 14], [0, 407, -109, 0, 0, 0, 0, 0], [0, 0, 0, -265, 0, 265, 60, 0], [0, 0, 0, 387, 0, 0, 0, -72], [1096, 0, 0, 0, 24, 0, 0, 0], [0, 0, 0, 0, 0, 348, 29, 29], [0, 146, 38, 0, 0, 0, 0, 0], [0, 0, 0, 409, 0, 0, 0, -29], [-1060, 0, 0, 0, -96, 0, 0, 0], [0, 0, 0, 0, 0, 143, 171, 171], [1054, -1054, 104, 0, -104, 0, 0, 0], [0, 0, 0, 0, 0, 191, -14, -14], [0, -340, -70, 0, 0, 0, 0, 0], [0, 0, 0, 123, 0, 0, 0, -75], [0, 448, -83, 0, 0, 0, 0, 0], [0, 0, 0, -235, 0, 0, 0, 77], [-506, 0, 0, 0, 42, 0, 0, 0], [0, 0, 0, -193, 0, 193, 71, 0], [-208, 208, 190, 0, -190, 0, 0, 0], [0, 0, 0, 0, 0, -389, 59, 59], [133, 0, 0, 0, -81, 0, 0, 0], [0, 0, 0, 0, 0, 192, 215, 215], [-7, 0, 0, 0, 30, 0, 0, 0], [0, 0, 0, -617, 0, 617, -152, 0], [0, 0, 0, 0, 0, 113, -57, -57], [0, 0, 0, -101, 0, 0, 0, -98], [0, -997, -127, 0, 0, 0, 0, 0], [0, 0, 0, -435, 0, 0, 0, 15], [0, 0, 0, -207, 0, 207, -37, 0], [0, 0, 0, 0, 0, -96, -74, -74], [-227, 0, 0, 0, -9, 0, 0, 0], [-494, 494, 221, 0, -221, 0, 0, 0], [-574, 0, 0, 0, -99, 0, 0, 0], [0, 0, 0, 197, 0, -197, 75, 0], [0, 0, 0, 0, 0, 424, 152, 152], [0, 592, 19, 0, 0, 0, 0, 0], [0, 0, 0, 258, 0, -258, 22, 0], [-566, 566, 197, 0, -197, 0, 0, 0], [0, 821, 101, 0, 0, 0, 0, 0], [0, 0, 0, 289, 0, -289, 31, 0], [-253, 253, -143, 0, 143, 0, 0, 0], [0, 0, 0, 400, 0, 0, 0, 43], [970, 0, 0, 0, -138, 0, 0, 0], [-116, 116, -19, 0, 19, 0, 0, 0], [296, -296, -8, 0, 8, 0, 0, 0], [0, 0, 0, 0, 0, -213, 133, 133], [0, 349, 154, 0, 0, 0, 0, 0], [0, 0, 0, 467, 0, 0, 0, -85], [0, 0, 0, 20, 0, -20, 110, 0], [0, 0, 0, 0, 0, 214, -39, -39], [1127, 0, 0, 0, -18, 0, 0, 0], [-343, 343, -269, 0, 269, 0, 0, 0], [0, -200, -164, 0, 0, 0, 0, 0], [0, 0, 0, -167, 0, 0, 0, -11], [-1276, 0, 0, 0, 21, 0, 0, 0], [0, 0, 0, 0, 0, 134, 0, 0], [-1433, 0, 0, 0, -129, 0, 0, 0], [0, 0, 0, 0, 0, -217, 190, 190], [0, 0, 0, 273, 0, 0, 0, 201], [0, 0, 0, -555, 0, 555, -211, 0], [0, 97, 340, 0, 0, 0, 0, 0], [496, -496, -280, 0, 280, 0, 0, 0], [0, 0, 0, 0, 0, 400, -213, -213], [0, 0, 0, -49, 0, 0, 0, -43], [0, 0, 0, -346, 0, 346, -21, 0], [1061, -1061, 127, 0, -127, 0, 0, 0], [0, -794, -92, 0, 0, 0, 0, 0], [-260, 260, -211, 0, 211, 0, 0, 0], [0, 0, 0, -41, 0, 0, 0, -155], [0, 0, 0, 133, 0, 0, 0, -215], [1537, 0, 0, 0, -93, 0, 0, 0], [0, 0, 0, 40, 0, -40, -132, 0], [0, 0, 0, 0, 0, -631, 181, 181], [0, 281, 371, 0, 0, 0, 0, 0], [-70, 0, 0, 0, -258, 0, 0, 0], [0, 0, 0, 735, 0, -735, 2, 0], [-361, 361, 211, 0, -211, 0, 0, 0], [0, 0, 0, 0, 0, 111, -191, -191], [0, 0, 0, 26, 0, -26, 248, 0], [1558, -1558, 86, 0, -86, 0, 0, 0], [0, 335, -259, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -120, 155, 155], [0, 0, 0, 340, 0, 0, 0, -116], [0, 0, 0, -122, 0, 122, 163, 0], [0, -551, 124, 0, 0, 0, 0, 0], [0, -1753, 35, 0, 0, 0, 0, 0], [0, 0, 0, -342, 0, 342, 233, 0], [-776, 0, 0, 0, -156, 0, 0, 0], [0, 0, 0, 542, 0, -542, -142, 0], [-638, 638, 125, 0, -125, 0, 0, 0], [0, 0, 0, 0, 0, 37, -99, -99], [0, 0, 0, -181, 0, 0, 0, -301], [926, -926, 316, 0, -316, 0, 0, 0], [0, 0, 0, 0, 0, -158, -178, -178], [0, -443, 286, 0, 0, 0, 0, 0], [1285, 0, 0, 0, -237, 0, 0, 0], [0, -853, -97, 0, 0, 0, 0, 0], [0, 0, 0, -35, 0, 35, -212, 0], [638, -638, -152, 0, 152, 0, 0, 0], [0, 0, 0, 0, 0, -412, -78, -78], [0, -1334, 169, 0, 0, 0, 0, 0], [0, 0, 0, 109, 0, 0, 0, 175], [0, 0, 0, 112, 0, -112, -42, 0], [0, 0, 0, -111, 0, 0, 0, 69], [0, 0, 0, 0, 0, 663, -35, -35], [-1037, 0, 0, 0, -117, 0, 0, 0], [0, -430, 134, 0, 0, 0, 0, 0], [614, 0, 0, 0, -180, 0, 0, 0], [0, 0, 0, 257, 0, -257, -57, 0], [0, 0, 0, 0, 0, -725, 119, 119], [-1415, 0, 0, 0, 195, 0, 0, 0], [0, 0, 0, 219, 0, -219, 43, 0], [0, -556, 236, 0, 0, 0, 0, 0], [0, 0, 0, -422, 0, 0, 0, -248], [0, 1483, 298, 0, 0, 0, 0, 0], [0, 0, 0, -926, 0, 0, 0, -23], [0, 0, 0, 28, 0, -28, -138, 0], [1810, -1810, 131, 0, -131, 0, 0, 0], [0, 0, 0, 0, 0, 557, 262, 262], [0, 0, 0, -183, 0, 0, 0, 159], [-1645, 0, 0, 0, 0, 0, 0, 0], [-973, 973, -359, 0, 359, 0, 0, 0], [0, 0, 0, 512, 0, 0, 0, -283], [56, 0, 0, 0, 516, 0, 0, 0], [-640, 640, -188, 0, 188, 0, 0, 0], [0, 0, 0, 0, 0, 982, 8, 8], [0, -731, -170, 0, 0, 0, 0, 0], [-520, 0, 0, 0, -276, 0, 0, 0], [0, 0, 0, 97, 0, -97, 313, 0], [-1252, 1252, -134, 0, 134, 0, 0, 0], [0, 0, 0, -569, 0, 0, 0, -80], [0, 0, 0, 0, 0, 341, -116, -116], [0, 2144, 74, 0, 0, 0, 0, 0], [0, 0, 0, 1032, 0, -1032, 83, 0], [0, 1150, -371, 0, 0, 0, 0, 0], [-749, 0, 0, 0, -39, 0, 0, 0], [-1664, 1664, -154, 0, 154, 0, 0, 0], [0, 596, 404, 0, 0, 0, 0, 0], [0, -2414, -173, 0, 0, 0, 0, 0], [-2000, 0, 0, 0, -108, 0, 0, 0], [0, 0, 0, 384, 0, -384, 4, 0], [82, -82, -469, 0, 469, 0, 0, 0], [695, 0, 0, 0, -186, 0, 0, 0], [0, 0, 0, 0, 0, 692, -144, -144], [0, 0, 0, 142, 0, -142, 324, 0], [0, -178, 164, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, -240, 52, 52], [1558, -1558, 113, 0, -113, 0, 0, 0], [0, -1078, -190, 0, 0, 0, 0, 0], [0, 0, 0, 50, 0, 0, 0, 56], [1028, 0, 0, 0, -285, 0, 0, 0], [0, 0, 0, 341, 0, -341, -393, 0], [-757, 757, 31, 0, -31, 0, 0, 0], [0, 0, 0, -1152, 0, 0, 0, 279], [0, 0, 0, 0, 0, 279, 239, 239], [0, 0, 0, 733, 0, 0, 0, -83], [0, 0, 0, 346, 0, -346, -143, 0], [0, 0, 0, 172, 0, -172, -174, 0], [1486, -1486, 77, 0, -77, 0, 0, 0], [0, 0, 0, -591, 0, 591, 122, 0], [1592, -1592, 244, 0, -244, 0, 0, 0], [0, 0, 0, 0, 0, 271, -54, -54], [0, 0, 0, -985, 0, 0, 0, 317], [1520, -1520, 64, 0, -64, 0, 0, 0], [0, -2333, -56, 0, 0, 0, 0, 0], [0, 0, 0, -285, 0, 0, 0, 345], [1231, 0, 0, 0, -39, 0, 0, 0]]
