
# q-expansion of newform 4320.2.a.m, downloaded from the LMFDB on 12 February 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 = 4320
weight = 2
poly_data = [-10, 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, 0], [-1, 0], [-2, 1], [2, 1], [0, 1], [-1, 1], [1, -1], [1, 0], [-2, 1], [-1, -1], [-2, 2], [0, 3], [-4, 1], [6, 0], [-7, -1], [8, -1], [-7, 0], [6, 0], [2, -1], [-6, 1], [-5, 3], [7, 2], [4, -1], [-4, -2], [8, -2], [-12, -2], [10, -2], [7, -4], [0, -6], [2, 0], [14, -2], [3, -1], [8, 4], [8, -1], [2, 0], [14, 1], [6, 2], [3, 6], [1, 3], [0, 6], [-5, 0], [6, 2], [8, 3], [-5, -1], [-8, -6], [21, -1], [-14, -2], [-3, -2], [17, 2], [6, 0], [14, -2], [-3, 4], [20, 2], [-13, 5], [6, -8], [-6, 2], [3, 7], [-10, -1], [-10, 3], [-16, -3], [-5, 5], [22, 0], [-8, 1], [-24, 2], [3, -3], [20, 2], [8, -3], [-12, 4], [-19, -2], [22, 2], [-2, 8], [6, -9], [16, -4], [-19, 3], [19, 0], [-8, -5], [4, -5], [-22, -2], [11, 6], [2, -7], [-25, -2], [-16, -5], [4, -1], [-21, 5], [3, 4], [38, 1], [-4, 0], [2, -8], [-30, 2], [-3, -6], [-2, 5], [-16, 3], [10, 4], [11, 3], [-11, 8], [12, -4], [8, -1], [-6, -5], [4, 10], [16, 3], [-6, -6], [-22, 2], [-30, -1], [-1, 3], [6, 7], [-27, 6], [11, -7], [16, -9], [-1, -8], [16, 5], [-12, -4], [1, -11], [20, -6], [7, -9], [28, -4], [-6, -3], [-1, -12], [15, -1], [4, -7], [36, 2], [-4, -7], [12, 6], [-3, -12], [37, 3], [-22, -2], [-16, 10], [-14, -4], [4, 6], [-8, 6], [33, 5], [-16, -4], [43, -1], [-2, -12], [-22, -1], [-9, 2], [-25, -5], [20, 9], [23, 1], [20, 3], [22, -8], [18, 12], [-32, 3], [-13, 2], [-32, 4], [-4, 2], [4, -14], [3, -5], [-15, -7], [-3, 2], [10, -3], [18, 9], [-18, -11], [25, -6], [-4, 2], [-40, 1], [16, 0], [-20, 1], [-4, -4], [14, 4], [-25, -6], [-26, 4], [6, -10], [26, -2], [-30, 6], [-27, -2], [31, 3], [18, -9], [-15, 8], [9, -9], [-44, 2], [27, 8], [-44, 1], [-32, 4], [15, -5], [10, 7], [-31, -1], [-30, 3], [-36, -5], [-4, -6], [16, 9], [20, -8], [-14, 0], [36, -6], [-7, 2], [-16, -8], [-12, 3], [-24, 4], [35, 4], [-12, -9], [-14, 14], [-9, 4], [7, -11], [16, 14], [-41, 2], [-27, 11], [-37, 8], [4, 16], [30, 6], [14, -6], [28, 9], [56, 2], [26, -10], [15, -4], [-20, -5], [-6, -12], [44, -2], [-11, -6], [-48, -2], [16, 12], [28, -3], [0, -15], [-16, -8], [-18, -6], [0, 10], [21, 2], [8, 7], [12, -6], [3, 12], [39, 1], [-2, -4], [-7, -9], [-18, -15], [-8, -3], [7, -6], [17, -12], [31, -1], [-2, -11], [6, -10], [0, 18], [-26, -11], [-15, 5], [32, 0], [26, -6], [-34, -5], [41, -8], [-13, -16], [-19, -5], [-10, 4], [10, -11], [-14, 2], [-11, 9], [-14, 6], [15, -12], [-14, 2], [66, -2], [40, -4], [8, 3], [-16, -4], [13, -10], [-6, -6], [-26, -16], [23, 14], [-11, -10], [43, 7], [32, 2], [5, 6], [-22, -15], [-27, 3], [0, -7], [40, -1], [-1, 14], [17, 0], [-28, 6], [-41, -11], [24, -4], [24, 10], [14, -4], [-54, -4], [-2, 6], [-17, -2], [-14, -22], [18, 1], [7, 7], [-26, 13], [-18, 7], [-7, -20], [49, -6], [-5, 10], [58, 7], [18, 18], [9, 19], [51, 0], [-33, -6], [16, -2], [-28, 13], [10, -18], [-42, 4], [-15, -13], [32, -14], [4, -14], [-71, -4], [14, -4], [62, 0], [30, 13], [52, 8], [33, -5], [34, 8], [-4, -16], [10, 7], [26, 17], [-21, 5], [40, -4], [-1, 2], [-65, -3], [-22, -11], [2, -14], [-27, 2], [18, -3], [38, -1], [69, 4], [20, 2], [56, -8], [2, -11], [3, 4], [3, -10], [4, 18], [-14, 7], [-12, 5], [-6, 20], [-9, -1], [-52, -12], [-28, -4], [28, -14], [21, 11], [28, 2], [7, -15], [-36, -4], [24, -12], [-25, 11], [2, -8], [6, -16], [42, 4], [-66, 4], [0, -22], [14, 22], [1, 6], [-49, -7], [-56, -4], [0, -11], [52, -6], [11, -13], [-18, -21], [-47, 13], [36, 6], [74, -3], [-33, -14], [20, 10], [-20, -20], [45, -3], [10, -8], [-18, 20], [34, 9], [4, 0], [-48, -12], [15, -15], [20, 19], [4, 1], [-14, 10], [49, -10], [72, -1], [10, -6], [22, 20], [-2, -16], [52, 4], [-32, -17], [-7, -7], [50, 8], [-2, 12], [-18, 24], [31, -21], [15, -26], [-8, 23], [-65, -5], [16, -18], [38, 2], [34, 14], [18, -13], [58, 6], [42, 14], [-32, 8], [-5, -5], [2, -17], [27, -11], [-8, 22], [-6, -12], [-45, -11], [-68, -9], [-8, 19], [8, -4], [4, 22], [19, 7], [-46, -6], [-22, 6], [-58, -8], [-6, 11], [-27, -19], [-34, -5], [-17, 5], [8, 4], [30, 4], [-82, 2], [-18, 13], [-2, 24], [54, 13], [15, -17], [-14, -16], [-22, 26], [-16, 20], [52, -7], [2, -4], [53, -5], [61, -8], [31, 5], [2, -4], [26, -5], [-42, -12], [-16, 16], [-1, 23], [33, -14], [-72, -2], [46, 14], [33, -2], [-22, 2], [22, 6], [-13, 5], [-37, -22], [46, -14], [-1, -9], [-18, 9]]
