
# q-expansion of newform 6720.2.a.p, downloaded from the LMFDB on 29 July 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
    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 = 6720
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], [-1], [-1], [1], [0], [6], [2], [8], [8], [2], [4], [2], [-6], [-4], [8], [-10], [-4], [2], [-4], [-12], [-2], [8], [4], [-6], [-18], [10], [8], [12], [18], [6], [8], [-20], [-10], [0], [-14], [8], [14], [-12], [8], [-6], [24], [2], [4], [18], [-18], [-4], [20], [-24], [4], [-22], [-18], [-4], [-6], [12], [-6], [16], [-14], [12], [-14], [18], [4], [-14], [-12], [24], [-10], [-2], [12], [-14], [20], [-14], [18], [-36], [-8], [10], [4], [-32], [-30], [22], [18], [-22], [12], [26], [28], [-2], [28], [-12], [-30], [18], [2], [-24], [-28], [32], [-16], [0], [-20], [-8], [2], [10], [-20], [18], [12], [-2], [-4], [42], [36], [-2], [-12], [-30], [-4], [18], [8], [18], [30], [0], [0], [-6], [-28], [24], [22], [0], [-38], [26], [-46], [-12], [0], [2], [26], [8], [16], [-26], [-20], [-48], [8], [10], [-54], [26], [-30], [-28], [-54], [18], [0], [42], [-16], [12], [42], [0], [30], [18], [40], [0], [58], [-30], [-4], [16], [-28], [36], [0], [-14], [-2], [18], [-20], [-2], [-8], [-20], [-10], [-16], [-24], [-2], [18], [34], [-32], [58], [52], [10], [-36], [26], [-20], [18], [32], [-22], [32], [20], [-54], [-38], [8], [-22], [-38], [-44], [26], [-8], [14], [-20], [-20], [34], [60], [-54], [18], [2], [-22], [8], [18], [-44], [-10], [10], [28], [10], [-36], [4], [-62], [-24], [10], [-22], [-56], [44], [0], [2], [8], [-30], [-32], [22], [26], [44], [-6], [64], [12], [58], [34], [4], [8], [0], [-14], [-8], [-32], [34], [12], [-40], [-30], [-2], [-48], [0], [-44], [48], [-56], [50], [-22], [-64], [40], [12], [60], [-64], [-38], [18], [24], [-38], [42], [56], [42], [68], [34], [70], [-56], [-20], [-22], [-2], [34], [-16], [-78], [-70], [-28], [-2], [-6], [52], [70], [8], [30], [16], [-52], [34], [10], [-44], [-24], [16], [-48], [-62], [-4], [68], [-54], [6], [28], [50], [18], [36], [62], [-12], [34], [-78], [28], [26], [-84], [-44], [-34], [-42], [16], [60], [-12], [-78], [-52], [-14], [-28], [42], [72], [90], [18], [-84], [-40], [34], [-20], [-12], [-50], [-78], [64], [82], [66], [-80], [38], [-70], [-36], [-76], [-48], [-42], [-46], [-74], [76], [12], [-20], [-12], [82], [-54], [-46], [-8], [10], [78], [-70], [-8], [54], [-64], [-70], [20], [40], [-30], [8], [-14], [-30], [-64], [-22], [90], [24], [36], [-58], [64], [-6], [42], [24], [72], [-44], [34], [18], [-8], [-38], [72], [-40], [-24], [34], [84], [58], [60], [84], [46], [50], [-82], [18], [-50], [64], [78], [56], [-24], [8], [-34], [36], [-24], [-46], [-22], [-24], [-28], [20], [10], [12], [-70], [36], [58], [-86], [6], [-32], [2], [90], [52], [-54], [50], [-20], [36], [-26], [70], [36], [20], [26], [-14], [-20], [-32], [82], [96], [-54], [-98], [8], [-4], [-26], [42], [4], [-54], [104], [-48], [-102], [-48], [44], [64], [14], [50], [10], [42], [20]]
