
# q-expansion of newform 2898.2.a.m, downloaded from the LMFDB on 20 April 2024.

# 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 = 2898
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], [0], [-1], [1], [-2], [-5], [2], [-2], [-1], [-5], [0], [-7], [3], [-11], [9], [10], [-12], [-2], [-4], [-6], [6], [-12], [4], [0], [-3], [-14], [19], [-14], [-3], [11], [-11], [6], [3], [5], [4], [-11], [-18], [10], [8], [-18], [25], [18], [-8], [-13], [-15], [17], [-8], [-4], [-15], [-10], [-6], [30], [-5], [1], [2], [1], [14], [-10], [-8], [-15], [-32], [26], [-25], [16], [22], [25], [26], [34], [25], [26], [-23], [15], [-15], [26], [-5], [6], [12], [14], [-6], [-14], [24], [13], [-3], [19], [2], [-29], [-32], [-22], [-24], [-17], [-1], [32], [7], [12], [-20], [18], [-24], [-2], [38], [-18], [42], [-22], [17], [-11], [-28], [-12], [-20], [15], [-16], [10], [14], [11], [-6], [22], [26], [-23], [-2], [-20], [-33], [12], [24], [-29], [-42], [36], [23], [42], [26], [-39], [0], [16], [-14], [24], [0], [-6], [-30], [-35], [7], [-24], [-5], [-30], [29], [-30], [-27], [-18], [-6], [36], [-11], [-45], [49], [20], [-48], [42], [24], [48], [7], [-17], [-34], [-21], [37], [-45], [-57], [14], [8], [-52], [-21], [24], [-20], [-50], [46], [-38], [2], [7], [-11], [-62], [-4], [-12], [20], [18], [-19], [-52], [-4], [31], [4], [33], [7], [51], [-16], [-42], [23], [-43], [20], [-29], [8], [-16], [-34], [-6], [2], [-46], [-50], [-37], [-6], [24], [-13], [-34], [63], [-52], [29], [20], [12], [-52], [-9], [-40], [-26], [28], [-1], [-54], [-32], [-69], [-15], [-21], [-18], [-20], [-12], [54], [-54], [-24], [4], [30], [47], [16], [38], [-34], [-50], [-62], [10], [-24], [-65], [2], [23], [40], [-34], [32], [-26], [64], [69], [63], [14], [29], [-35], [-3], [27], [-10], [-75], [7], [24], [5], [5], [16], [28], [2], [-10], [42], [-61], [14], [-54], [18], [-56], [-56], [-35], [70], [31], [-28], [21], [-42], [-60], [-24], [33], [62], [-42], [57], [21], [-40], [-18], [58], [-15], [36], [-82], [70], [-40], [-45], [64], [3], [-36], [-45], [-4], [54], [49], [0], [24], [-63], [-21], [54], [-8], [-65], [5], [-83], [-63], [-58], [-45], [-38], [-13], [80], [-18], [56], [-8], [74], [-10], [68], [-11], [14], [16], [4], [-64], [-83], [75], [78], [4], [13], [-37], [52], [-22], [-33], [26], [-54], [-7], [-14], [29], [-20], [-28], [-73], [82], [-67], [22], [22], [-76], [61], [35], [-90], [54], [-83], [12], [37], [-63], [-56], [65], [-87], [14], [-72], [2], [86], [-2], [35], [-74], [-6], [49], [51], [64], [60], [98], [-4], [-21], [76], [42], [-8], [54], [-94], [39], [77], [66], [-54], [18], [42], [16], [-12], [2], [67], [79], [-85], [11], [46], [50], [64], [21], [-23], [12], [-56], [35], [-30], [17], [35], [55], [38], [12], [4], [-4], [6], [-37], [8], [92], [-24], [-38], [-21], [-54], [20], [-42], [-60], [18], [-94], [30], [106], [86], [12], [42], [-12], [34], [58], [-96], [4], [63], [97]]
