
# q-expansion of newform 5625.2.a.f, downloaded from the LMFDB on 17 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 = 5625
weight = 2
poly_data = [-1, -1, 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], [0, 0], [0, 0], [-1, 1], [2, 2], [-3, 3], [2, 2], [-4, 3], [-7, 2], [2, 1], [-3, 0], [3, -2], [4, -2], [0, -3], [1, -1], [-3, 4], [6, 3], [-1, 6], [8, -2], [5, 1], [-9, 0], [0, -5], [3, 2], [-4, 8], [1, -3], [5, -4], [-6, 9], [-3, 12], [10, 0], [-12, -3], [-6, 16], [11, -11], [-1, 8], [5, 0], [-9, 8], [0, 9], [-3, 10], [11, 0], [0, -9], [7, -16], [7, -4], [10, -6], [18, -10], [-2, 6], [6, -6], [-3, -9], [7, -10], [16, -10], [-18, 2], [12, 6], [-10, 8], [27, -4], [9, -4], [13, 10], [-18, -3], [19, -5], [16, -2], [-8, 0], [-15, -6], [-2, -5], [-25, -3], [26, -4], [6, 2], [19, -17], [-20, 2], [15, -14], [6, -18], [3, 3], [28, -5], [12, 6], [-21, 5], [17, -19], [-11, -9], [-4, -15], [-21, 22], [-1, -20], [-15, 0], [8, 13], [9, -22], [21, -12], [3, 4], [32, 0], [-9, 24], [22, 3], [-7, -21], [-17, -8], [-16, 7], [-2, -12], [-17, 10], [5, -18], [13, -25], [6, 3], [-17, -12], [-15, 36], [-7, 9], [18, 12], [9, 7], [3, -20], [-18, 3], [-2, 18], [-31, 6], [-8, 2], [-9, 1], [-27, 4], [21, -18], [18, -32], [-15, 6], [19, -5], [3, 4], [27, -15], [-21, -9], [19, -21], [-11, -2], [37, -4], [-7, -2], [-7, 5], [8, -24], [-12, 30], [-11, -5], [-22, 4], [-24, 27], [-4, 10], [-9, -1], [7, 4], [12, 15], [-14, 34], [15, -30], [33, -6], [10, 9], [14, -21], [-18, 21], [4, -20], [-31, 16], [11, 12], [-22, 25], [-6, 12], [-14, 31], [-28, 10], [-13, 2], [3, -21], [-5, -6], [-3, 27], [38, 6], [22, -13], [-31, -3], [-6, -3], [30, -28], [24, -27], [-21, 12], [36, -9], [12, -30], [8, 20], [-40, 12], [-4, -16], [25, -36], [37, 2], [-16, -23], [15, -35], [42, -15], [27, 12], [20, -14], [-23, 19], [30, -16], [-4, -1], [25, -14], [-8, -1], [17, -20], [-1, 16], [-35, 20], [-1, -35], [29, -28], [-16, 31], [28, -25], [-27, 6], [-13, 6], [37, -34], [4, 6], [-39, -6], [27, -42], [-3, -29], [-39, 32], [-32, 20], [2, 3], [-42, 20], [-1, 20], [3, -26], [21, 12], [9, -21], [-30, -10], [48, -15], [-47, 21], [-20, 8], [-5, -21], [-18, 32], [-31, 53], [5, -7], [-4, -8], [-20, 17], [-46, 28], [51, 6], [14, -28], [1, 42], [20, 24], [4, -43], [12, 6], [-14, -11], [21, -27], [-39, 51], [3, -6], [-16, 36], [-34, -3], [-23, -8], [9, -36], [-3, -3], [-13, 41], [-15, 24], [-19, 7], [29, -7], [-54, -6], [-3, -36], [-37, 18], [-20, 0], [-13, 26], [-24, 55], [28, -40], [44, -33], [15, 18], [-5, 10], [23, 3], [-21, -17], [-40, 37], [-4, 28], [8, 18], [-56, -2], [12, -12], [30, -14], [-22, 9], [26, -19], [-35, -5], [-7, 20], [12, 9], [-2, -22], [24, 19], [-39, 3], [19, -35], [7, 41], [9, -24], [27, -38], [17, 6], [-10, -22], [-21, 36], [-7, 20], [40, -49], [32, -9], [0, 18], [-1, -38], [-9, -23], [42, -30], [10, -34], [-25, -26], [-34, 30], [16, 19], [-29, 3], [49, -46], [-44, 34], [-2, -16], [31, -47], [-6, 48], [-31, -6], [33, -38], [3, -2], [-9, 47], [62, 3], [29, -18], [-17, -7], [33, 16], [-3, 32], [-22, 34], [-41, -24], [-24, -11], [1, 1], [-31, 51], [39, -27], [-3, 30], [-49, -3], [-2, -20], [33, -44], [-13, 2], [-5, -30], [48, -61], [14, 8], [-50, 46], [67, -26], [-39, -6], [1, 15], [27, -54], [-48, 25], [-24, 11], [12, 21], [45, 14], [-5, 17], [-51, 18], [-11, 42], [-27, 12], [50, 9], [9, -14], [-10, 1], [-49, 3], [-15, 40], [-38, 23], [20, 28], [-28, 26], [72, 2], [42, -2], [-15, -19], [-1, -38], [-31, 62], [21, -41], [-15, -8], [-17, 4], [39, -29], [-31, 21], [5, 26], [27, 38], [23, 2], [18, -42], [42, 21], [47, 18], [4, -17], [-34, -4], [22, 15], [-23, 7], [75, -30], [-8, 4], [43, -7], [64, -47], [7, 36], [60, -47], [41, -18], [-68, 0], [-37, 46], [49, -2], [-58, 16], [10, -1], [9, -25], [-4, -2], [-36, 36], [9, -24], [36, -76], [-10, 31], [16, -43], [-45, 54], [-27, 30], [56, -60], [-40, 15], [-11, 35], [23, -1], [39, 3], [45, -64], [-21, -15], [31, 27], [16, 4], [20, -19], [-22, -26], [-24, 47], [66, -45], [-63, -3], [-76, 9], [17, -15], [60, -54], [-3, 51], [13, -8], [31, 13], [-29, -13], [36, 12], [-30, 0], [18, -50], [59, -26], [31, -62], [-12, -22], [-32, 40], [-39, 21], [72, -30], [-18, -33], [-50, -10], [26, 41], [40, -21], [61, 12], [-29, 35], [-14, 34], [15, -45], [10, 23], [27, -19], [-51, -9], [39, -22], [-27, -44], [12, 6], [54, 2], [63, -42], [38, -35], [-39, 18], [38, 22], [19, 41], [-79, 29], [0, 35], [39, -24], [16, -43], [-40, 56], [32, -2], [-3, 46], [-5, 12], [33, -25], [45, -37], [12, 0], [-20, -51], [70, -34], [-14, 13], [-6, 11], [1, -46], [-19, 16], [21, 13], [8, -57], [20, 41], [53, -11], [26, -60], [3, -45], [-31, -5], [-23, -34], [58, -22], [32, 26]]
