
# q-expansion of newform 2280.2.a.m, downloaded from the LMFDB on 25 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, ZZ
    R = PolynomialRing(QQ, "x")
    f = R(poly_data)
    K = NumberField(f, "a")
    betas = [K([c/ZZ(den) for c in num]) for num, den in basis_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 = 2280
weight = 2
poly_data = [-1, -1, 1]

# The entries in the following list give a basis for the
# coefficient ring in terms of a root of the defining polynomial above.
# Each line consists of the coefficients of the numerator, and a denominator.
basis_data  = [[[1, 0], 1], [[-1, 2], 1]]

hecke_ring_character_values = None
aps_data = [[0, 0], [-1, 0], [-1, 0], [1, 1], [-1, -1], [-1, 1], [0, -2], [-1, 0], [2, -2], [-5, 1], [4, 0], [-3, -1], [-3, 3], [1, 1], [2, -2], [-4, -2], [-6, 2], [0, -2], [-2, 2], [-4, 4], [4, 2], [-4, -4], [0, 0], [-11, 3], [-7, -5], [-8, -2], [6, -6], [0, 4], [-4, -2], [-10, 4], [4, 0], [-3, -3], [-6, 4], [-14, -2], [-8, -2], [0, 4], [-4, -6], [-1, 7], [16, 4], [-14, -4], [-10, -2], [-8, 2], [7, -1], [-9, 1], [-4, 6], [-6, 2], [4, -8], [-6, 6], [20, -4], [0, -2], [-14, -4], [9, 1], [6, -4], [-5, 3], [2, -8], [4, 8], [-1, -3], [6, -2], [20, 2], [3, 1], [-5, 3], [-6, 4], [-2, 2], [15, -1], [22, 4], [-8, 10], [8, -8], [9, 3], [-8, 8], [10, 4], [14, 8], [-9, -1], [15, -1], [-1, 1], [-24, 0], [-8, -8], [14, -4], [12, 10], [-29, 1], [0, 14], [3, 3], [14, 0], [14, -10], [11, -11], [-4, 4], [-2, -10], [5, -13], [10, -8], [-16, 6], [-5, -13], [22, -2], [-25, 7], [-18, -6], [-15, 1], [-10, 10], [4, 8], [5, 11], [15, -11], [-4, -8], [22, 0], [22, -6], [-2, -12], [4, 12], [-7, -17], [-2, 10], [18, 0], [26, -6], [-14, 12], [-6, 10], [20, -6], [-2, -6], [-12, 10], [16, -10], [14, -6], [8, 16], [1, 15], [19, 11], [20, 8], [-24, 2], [-16, 0], [44, -2], [-11, 7], [4, 6], [-20, 0], [22, 10], [-16, 6], [0, -2], [-11, -3], [-9, -1], [-6, -8], [-16, -4], [4, 12], [-4, -8], [14, 4], [-16, 14], [34, 0], [4, -10], [-20, 0], [-30, 4], [14, -4], [-32, 4], [4, 2], [11, 3], [36, -4], [-4, -2], [-4, -20], [6, -4], [-4, 10], [-16, -4], [12, 12], [3, -19], [8, -2], [-5, -13], [8, 0], [-48, -4], [0, 8], [-48, 0], [14, 12], [-8, 14], [3, -7], [-8, 16], [-6, 8], [-5, 3], [-24, 0], [20, -14], [0, -12], [24, 8], [32, 6], [-26, 4], [-6, 8], [-32, 0], [-2, 0], [-25, -9], [-22, -8], [-16, 16], [18, -8], [6, 10], [-4, 2], [-18, -14], [-2, 0], [-11, 5], [-8, 8], [-5, -3], [-18, 12], [30, 10], [20, 2], [-11, 15], [24, -4], [-28, -6], [21, 13], [-41, -7], [-46, 2], [-4, -16], [-13, 1], [14, -10], [-30, -16], [-4, -10], [42, 8], [28, 10], [10, 14], [23, -11], [36, -12], [-9, 1], [-18, -12], [1, 1], [-16, 2], [-12, -4], [16, 0], [-12, -6], [-20, -8], [-30, 0], [30, -12], [35, -5], [16, 0], [-14, -14], [12, 18], [-17, -17], [43, 9], [24, 20], [-48, -6], [-18, 16], [-20, 8], [49, -1], [-35, 5], [4, -12], [46, -8], [2, 0], [-34, 6], [-12, 8], [-3, -3], [-34, -4], [4, -4], [20, 20], [-59, 3], [33, -7], [-26, -6], [-36, 6], [74, 0], [53, 5], [-30, 2], [28, -8], [-24, 4], [-7, -7], [16, -22], [48, 6], [-3, -27], [-35, 13], [-26, -2], [-20, 4], [28, 0], [-26, -12], [-6, -24], [12, 0], [-24, -10], [16, 26], [-49, -9], [24, -10], [-12, 0], [-32, 10], [-36, -14], [38, -14], [8, 12], [54, 0], [-1, -15], [-28, 2], [0, -8], [-37, -7], [6, -28], [48, -12], [0, 2], [38, 8], [-30, -18], [-8, 6], [58, 2], [-7, -13], [35, 11], [56, 0], [-12, 30], [4, 26], [-15, -15], [0, 16], [0, -24], [10, -18], [34, 4], [-11, 13], [67, -5], [-42, 4], [-56, 10], [-4, -20], [41, 15], [-32, -18], [12, -4], [52, 2], [8, 24], [15, 1], [26, 24], [60, 4], [36, 14], [30, 22], [65, 9], [-16, -18], [-16, 18], [16, 0], [20, 12], [-14, -10], [-27, -9], [12, 16], [30, -16], [-25, -9], [6, 36], [14, -22], [50, -16], [43, -7], [70, -6], [-20, -8], [-54, -8], [-7, 17], [-20, -12], [42, 8], [16, -18], [32, -8], [36, 10], [-29, 25], [36, -8], [-16, 6], [-10, -12], [24, -4], [-12, -8], [52, 16], [64, 10], [62, 0], [-52, -10], [22, -2], [36, -12], [-6, -18], [32, -8], [-34, -8], [-4, -22], [-56, -6], [-35, 13], [59, -3], [22, 8], [41, -1], [80, -4], [-32, -6], [-16, -32], [36, 10], [-6, -26], [-22, 26], [-38, -8], [12, -28], [-49, -15], [-82, 4], [46, -14], [-40, 18], [-24, 6], [25, 1], [3, -5], [16, -18], [4, -4], [-12, -30], [20, 18], [-52, -12], [16, 8], [39, -17], [-37, 5], [6, -4], [-22, -18], [-40, 6], [-55, -7], [28, -8], [-12, -8], [-11, -37], [36, 20], [0, -2], [18, 34], [45, 13], [-10, -12], [-38, 24], [-35, -9], [5, -21], [-44, -6], [-45, 3], [-14, 20], [68, 4], [32, -28], [66, -6], [32, -18], [-65, -1], [-20, -24], [24, 14], [32, -22], [-17, -33], [-77, 3], [-46, 18], [19, -11], [4, 24], [-5, 1], [-60, 12], [22, 20], [-50, 16], [4, -30], [-36, -16], [-22, 0], [-45, -7], [-52, -20], [-48, 22], [17, 15], [14, 26], [7, 7], [-23, 19], [-68, 6], [-24, -20], [10, 22], [-36, 10], [12, 2], [-42, 6], [8, 20], [42, -4], [-64, 0], [-27, -5], [-49, 1], [-38, 14], [50, -14], [-57, 9], [-66, 8], [-40, -28], [-26, -4], [10, 30], [-39, 1]]
