
# q-expansion of newform 9576.2.a.m, downloaded from the LMFDB on 07 December 2025.

# 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
    R = PolynomialRing(QQ, "x")
    f = R(poly_data)
    K = NumberField(f, "a")
    betas = [K.gens()[0]**i for i in range(len(poly_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 = 9576
weight = 2
poly_data = [0, 1]

# The basis for the coefficient ring is just the power basis
# in the root of the defining polynomial above.
hecke_ring_character_values = None
aps_data = [[0], [0], [0], [1], [-2], [6], [0], [-1], [-6], [-6], [8], [6], [-6], [-12], [6], [2], [-12], [2], [-8], [-12], [-6], [0], [14], [2], [-6], [12], [4], [-20], [10], [-6], [-4], [2], [12], [-20], [-24], [0], [2], [-4], [8], [-2], [4], [22], [-2], [-14], [12], [8], [-8], [4], [24], [2], [-8], [6], [10], [6], [-26], [-18], [-18], [0], [-22], [6], [4], [-2], [-8], [6], [-10], [-10], [-4], [6], [14], [22], [0], [14], [-8], [-34], [-28], [-28], [-12], [22], [-30], [26], [-22], [2], [-36], [6], [-4], [-34], [6], [2], [20], [16], [-42], [-6], [-4], [-18], [-4], [2], [-18], [18], [-36], [38], [-20], [24], [0], [6], [20], [-2], [-18], [-36], [16], [14], [-40], [42], [36], [-28], [-8], [-38], [28], [14], [-8], [16], [26], [10], [42], [36], [-28], [16], [22], [22], [-24], [14], [-36], [-4], [-40], [10], [-16], [-50], [-42], [4], [-2], [-40], [-24], [32], [-48], [-4], [30], [-4], [6], [-54], [52], [12], [-2], [0], [28], [-8], [-16], [-8], [-16], [28], [2], [-2], [-42], [22], [32], [32], [-6], [24], [-20], [-6], [-2], [-44], [60], [34], [-54], [-58], [8], [20], [-20], [-8], [32], [14], [-32], [-32], [10], [22], [26], [20], [42], [44], [-34], [38], [34], [54], [-28], [34], [38], [-54], [2], [38], [-52], [-30], [-62], [-16], [-34], [10], [-30], [36], [48], [-36], [68], [16], [54], [-40], [-56], [44], [36], [-34], [-48], [58], [-12], [-36], [10], [4], [50], [-32], [-24], [2], [46], [20], [-8], [-26], [18], [-16], [-20], [18], [68], [46], [-30], [-44], [30], [-12], [20], [4], [-56], [62], [54], [-62], [-32], [56], [20], [50], [-30], [20], [18], [-38], [-64], [78], [-58], [24], [-54], [-58], [-24], [32], [22], [74], [68], [60], [34], [-4], [68], [20], [-30], [-48], [-34], [-32], [-62], [8], [-6], [30], [10], [14], [-28], [80], [66], [-22], [12], [2], [14], [78], [24], [-42], [48], [78], [38], [-12], [-26], [56], [52], [72], [-48], [-44], [-58], [-46], [-64], [-12], [-76], [54], [-40], [38], [58], [6], [2], [-36], [-14], [-68], [2], [10], [-78], [80], [-62], [12], [76], [42], [42], [-48], [36], [50], [20], [76], [60], [32], [-46], [18], [40], [-22], [44], [78], [-2], [-30], [6], [56], [-82], [-68], [-22], [-20], [74], [-72], [74], [-8], [32], [44], [44], [70], [60], [0], [86], [50], [-30], [-18], [4], [20], [6], [8], [-28], [-36], [-28], [42], [12], [44], [-46], [18], [-16], [-54], [-30], [-88], [-34], [80], [34], [-78], [60], [-30], [42], [-8], [-24], [88], [-28], [-76], [8], [18], [-20], [8], [-90], [74], [78], [100], [20], [-66], [64], [30], [24], [-28], [10], [-48], [24], [-82], [-42], [96], [-2], [62], [88], [-6], [-34], [12], [24], [-92], [-38], [-44], [48], [-16], [40], [-76], [-78], [34], [42], [48], [70], [46], [-84], [64], [-92], [70], [106], [-42], [4], [8], [-2], [76], [-86], [-58], [88], [16], [70], [-100], [-50], [-100], [-82], [-2], [-28], [-16], [-98], [-82], [-20], [-60], [-6], [-76], [-54], [30], [-86], [44], [34], [6], [-24], [-20], [-104], [-50], [4], [46], [68], [-66], [-84], [-12], [56], [36], [-72], [-86], [36], [62], [-40], [80], [22], [94], [58], [-90], [-70], [78], [-96], [-62], [-90], [-20], [44], [100], [82], [-60], [-70], [-34], [-42], [-22], [36], [112], [-56], [100], [-60], [-80], [-110], [-72], [-106], [4], [40], [-32], [-6], [-84], [6], [-6], [-14], [78], [-76], [-14], [-98], [46], [-24], [60], [90], [20], [-34], [-34], [50], [-54], [-14], [36], [76], [-62], [56], [-38]]
