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