
# q-expansion of newform 7500.2.a.f, 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 = 7500
weight = 2
poly_data = [11, 7, -6, -2, 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, 0, 0], 1], [[0, 1, 0, 0], 1], [[-4, -1, 1, 0], 1], [[0, -4, -1, 1], 1]]

hecke_ring_character_values = None
aps_data = [[0, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [-1, -1, -1, 0], [1, -1, 1, 1], [-2, 1, 0, -1], [-1, 1, 1, 0], [-1, -1, 0, -1], [-3, 2, 1, -1], [2, -1, 0, 0], [2, 1, -2, 3], [-2, 3, 0, 0], [-1, 4, 2, 0], [1, 2, 1, 0], [-6, -1, -6, 2], [-1, -1, -3, -2], [-4, 1, -7, -1], [-1, -2, 8, -2], [-9, 2, 1, 2], [6, 1, 3, 0], [0, -2, 3, 2], [3, -4, 4, -1], [1, -6, 4, -2], [-8, 1, -6, -3], [3, -4, -2, -4], [-2, 1, 5, 2], [-4, -1, 6, 1], [-5, -4, -3, 0], [-9, 2, -2, 5], [-11, -1, 2, -3], [-6, -1, 2, -6], [-2, -2, -5, -5], [-10, -1, -9, 3], [-12, -2, -10, 4], [11, 0, 10, -3], [0, -4, 7, -2], [3, 4, -6, 5], [-3, 3, -1, 6], [2, -1, 3, 2], [-3, -1, 6, 0], [6, 1, -5, 5], [2, 3, -8, 5], [14, -7, 4, 3], [8, -5, 8, -3], [-9, 6, 1, 0], [12, 1, 1, 1], [-8, -3, -3, 3], [2, -7, -6, 1], [-2, -1, -8, 6], [10, 1, 15, -7], [1, 6, -1, 3], [-13, 3, -10, 2], [-13, 0, -1, -7], [-5, -1, 14, -2], [1, 7, -1, -3], [-2, -4, 5, -2], [6, 6, -8, 8], [5, 0, -4, 7], [-13, -5, -14, 9], [16, -7, -3, -3], [-18, 7, -4, -3], [-2, -2, 16, -2], [-13, 0, -6, -3], [3, 6, 5, -2], [8, -4, 9, 2], [12, -1, -2, -6], [-4, 2, -10, -5], [-14, 2, -2, -1], [-23, -1, -12, 2], [10, 1, 12, -6], [3, 4, -2, 1], [9, -3, -4, -3], [-10, -1, -3, 3], [6, 2, 8, -9], [-1, 8, 14, -3], [-9, 2, -3, -4], [0, -11, -10, 4], [-1, 1, 6, -7], [5, 7, 13, -1], [0, 5, 8, 0], [-10, -3, -7, 0], [-17, 6, -17, 3], [16, 3, -2, 7], [0, -2, 7, 3], [-1, 4, 3, -4], [-16, 0, -1, 4], [10, -1, 15, -4], [-18, 3, -18, 5], [20, 2, 7, 6], [-9, 0, 2, 2], [13, -1, 7, -2], [14, -2, 15, -14], [12, 1, -5, 3], [12, -2, 10, -7], [18, 4, 10, -6], [-5, -6, -13, 10], [-8, -3, -7, 3], [15, -8, -7, -5], [-4, 2, 0, -5], [0, 2, -5, 2], [-16, 0, -5, 4], [12, -11, 2, -5], [7, 2, 15, 2], [11, 0, -9, -2], [10, -5, 6, -7], [-11, 3, 6, 3], [-13, 6, -12, 8], [3, 1, 23, -3], [-1, -1, -17, 4], [3, 4, -3, 4], [1, -4, 20, -2], [10, -3, -3, -3], [12, 2, 11, 11], [6, 6, 13, 4], [-25, 1, -15, -1], [-12, -7, 6, 0], [-5, 7, -18, 6], [-18, 3, -22, -5], [27, -4, 0, -1], [-5, 13, -14, 7], [-16, 0, -4, -8], [-15, 9, 11, 6], [19, -3, 1, 2], [-8, 4, -9, 5], [-4, 10, -6, 9], [28, -10, 2, 4], [-14, 10, 3, -8], [1, -4, 12, -10], [-5, -9, -12, -6], [-13, -12, 10, -7], [4, 5, -7, 0], [-17, 2, 7, -2], [-8, 12, -2, 3], [3, -6, 9, -12], [17, -11, 0, -2], [-14, -8, 15, -5], [12, -8, 2, -9], [23, -2, 13, 0], [-12, 2, -16, 11], [12, -16, -12, -4], [0, -9, -2, 1], [-25, -5, -5, 6], [-23, 2, -7, 8], [8, -10, 21, -7], [2, -11, -16, -5], [13, -4, -10, 3], [26, -12, 2, 9], [6, 7, 1, 19], [23, -10, 5, 7], [-21, 6, -16, 3], [6, 3, -19, -1], [2, 0, 2, 4], [4, -5, -1, -4], [-47, 4, -3, -5], [5, -13, 0, 1], [-15, -3, -11, 14], [-23, 10, -1, 8], [5, -4, -12, -11], [17, -2, 4, -7], [4, 5, -16, -2], [3, -5, 18, -17], [16, 12, 10, -6], [-2, 18, 11, 1], [14, -10, 3, 3], [-6, 1, -4, -11], [8, 2, -9, 1], [9, -2, -1, -8], [28, 4, 9, 8], [0, -10, -3, -8], [-9, 7, -16, 14], [9, -2, -16, 7], [-24, 0, -3, 12], [-13, 2, 16, -3], [9, -12, 8, -16], [12, -16, 18, -11], [-32, -3, -16, 1], [-24, 4, -19, -1], [26, -4, 16, -6], [-24, 2, -12, -13], [5, -1, 2, 13], [6, -15, -3, 6], [11, -13, 27, -10], [7, 11, -1, -1], [-22, 4, -36, 6], [-24, 6, -16, -2], [-22, 16, 13, 8], [3, 0, -3, -6], [7, -7, -2, 0], [2, 12, -16, 12], [17, 4, -6, 12], [-22, 7, -15, 5], [3, -20, 12, -6], [-7, -17, 21, -13], [30, 6, 27, -3], [3, -5, 31, 2], [41, 1, 38, -1], [1, -4, 0, -2], [19, 2, -20, 5], [28, -2, 18, -19], [22, -12, -7, -12], [-1, 11, -12, -2], [0, -2, 17, -14], [18, -8, 33, -2], [-40, -4, -17, 2], [-3, -9, -27, -5], [13, 4, 23, 3], [-58, 5, -10, -3], [-1, 11, -31, 14], [22, 4, 29, 2], [13, 0, -14, 13], [-2, 1, -3, -8], [-10, -6, -8, -16], [-13, 11, -19, 7], [3, 15, 22, 2], [-4, 12, -28, 20], [-35, -1, -11, 0], [15, -1, -11, 18], [19, 13, -20, 13], [39, -15, 22, 5], [8, -12, -35, -3], [-9, 1, 15, -2], [33, -12, -2, 6], [24, -6, 12, -15], [-7, -11, 11, -11], [20, 11, -13, 8], [-23, 6, -25, -11], [37, -15, 11, 9], [11, 9, -3, 10], [15, -11, 15, 1], [-2, -2, 18, -8], [36, 1, 26, 3], [-7, -4, 12, 0], [19, 14, 2, 0], [22, -13, 6, -7], [-20, 4, -21, 2], [-9, 1, 34, 4], [25, 7, 28, -12], [10, -19, 32, -8], [-13, 0, -15, -10], [12, -15, 6, -12], [-12, -1, -4, 14], [-27, 5, 10, 5], [32, -15, 8, -10], [-9, 4, -8, -14], [17, -12, -7, 4], [-11, -1, 14, -6], [0, 17, -10, -6], [36, -2, 23, 10], [-13, 19, 18, 5], [-12, -1, -22, 1], [13, 15, -8, -5], [20, 5, -15, 17], [10, -4, 20, 0], [30, -5, 29, 0], [-38, 1, -33, -7], [-21, 2, 16, -10], [-25, 12, 20, 11], [10, 10, 42, 5], [33, -12, 3, -3], [-2, -1, -23, 12], [-8, 3, -2, 7], [18, 5, 26, -17], [-5, -9, -29, -8], [27, 15, -6, 0], [13, -3, 22, -9], [-38, 13, -21, -6], [40, -4, 26, -8], [12, 14, 13, 8], [-31, 4, -40, -2], [0, -2, -7, -7], [-8, -4, -31, -7], [-4, -2, 22, 2], [-1, 5, 11, 0], [-14, 27, 1, -8], [11, -5, -14, 2], [28, 9, 12, 4], [-3, 7, 6, -9], [29, 9, 5, -1], [-28, -1, -23, 5], [-14, 19, -25, 14], [-22, -6, 3, -10], [-21, 23, -11, 11], [-9, -17, -29, -1], [4, -22, 0, 9], [18, -15, 43, -8], [5, -17, 0, 4], [59, 0, 28, 1], [40, -15, 20, 9], [2, -12, -1, -28], [47, 11, 10, -6], [39, 0, 6, -15], [28, -4, 18, 5], [4, -5, -19, -6], [-13, -1, 15, 7], [2, -4, -20, 7], [27, -2, 2, 16], [-21, -9, -41, -5], [5, 16, -16, 24], [-24, 1, -24, 18], [-13, 7, -5, -19], [-12, 14, 4, -1], [24, 13, 0, 10], [-28, 20, -7, 0], [-5, 5, -3, -10], [25, -10, 1, -16], [-11, 9, -26, 13], [-7, -1, -9, -21], [27, -12, 12, 0], [-6, 0, 14, -8], [-10, -12, -40, -1], [15, 10, 23, -20], [13, 19, 12, -14], [17, -13, -1, -11], [-14, -11, -28, -7], [-11, 3, -14, 1], [5, -15, -14, 11], [-31, 17, -28, 2], [-7, -6, 22, 9], [-6, -1, 16, 2], [1, -7, -16, 23], [-33, -13, -18, 8], [3, 17, 10, 18], [-6, 13, -5, -14], [-38, -4, -47, 5], [26, 10, 0, 7], [-2, -26, 21, -13], [-10, -15, 2, -10], [40, 0, 7, 19], [-42, 15, 3, -4], [-30, -7, -4, -14], [28, -4, 21, -14], [40, -13, 0, 3], [25, 5, 11, -3], [-30, -6, -38, 29], [23, -7, 1, -16], [-7, 22, -11, 17], [16, 5, -13, -7], [11, 7, 36, -5], [4, -4, -19, 23], [-5, 0, -55, 2], [-2, -2, -27, -2], [-28, 4, 17, 2], [-18, -1, -44, 2], [-22, -14, -28, 12], [3, -19, 18, -1], [-23, 19, -27, -8], [-4, 17, 2, 16], [-9, 7, -5, -21], [-31, -2, -43, 3], [29, -11, 4, 18], [-25, 14, -30, -12], [11, -15, 43, -8], [-7, 15, -24, 11], [-35, 9, -21, 12], [-4, -22, 11, -2], [42, 3, 33, 6], [27, -3, 40, -1], [19, -21, -2, -14], [-7, -7, 6, -34], [-29, 22, 20, 6], [8, 7, 36, 11], [-34, 1, -7, -1], [-8, 29, 14, 3], [-20, 7, -12, -5], [27, -30, -3, 4], [0, -25, 12, -4], [-25, -6, -35, -9], [-36, 15, -28, 14], [-7, -3, -6, -12], [28, 3, 17, -6], [-24, 16, 9, -1], [-35, 21, -14, -14], [-3, 3, 42, -8], [22, -21, 3, 12], [37, 5, 25, 8], [10, 5, 8, -22], [-49, -2, -16, -10], [-6, -28, 13, -4], [14, 23, 29, -1], [-19, 14, 3, -9], [5, -10, 23, -22], [-27, -4, 3, 2], [-16, -14, 14, 4], [-28, 31, 0, -17], [23, -15, 7, 7], [61, 8, -19, 6], [5, 23, -20, 14], [14, 5, -6, 14], [33, -4, 28, -19], [40, -6, 43, 9], [-13, -9, -10, 4], [66, 9, -5, 8], [9, -19, -8, 14], [14, 15, -40, 4], [-10, 0, -34, 3], [-16, -4, 41, -6], [-19, -20, -28, 10], [26, 4, 37, -13], [44, 5, -21, 5], [-25, -4, -50, 9], [49, 14, 34, -16], [-53, 11, 11, 13], [-45, -5, -55, 2], [-21, 1, -11, 20], [-23, -12, 16, 1], [40, -30, -5, -6], [25, -12, -8, -1], [19, -9, 19, -2], [63, -21, 33, 16], [-26, 16, -14, -8], [-31, 32, 17, -2], [10, 19, 14, -9], [-10, 11, 18, -3], [-1, 15, -6, -7], [-32, 5, 30, -8], [-1, 15, 21, 19], [-15, 9, 32, 13], [-26, 21, 6, -21], [-24, 8, 3, 2], [-9, 4, 17, 21], [-61, 8, -12, -8], [53, -10, 9, 10], [21, 23, -20, 21], [-54, -12, -30, 2], [-1, -4, 31, -8], [-30, 12, -46, 13], [-14, 8, 37, 13], [13, 18, -12, 5], [38, -1, 3, 19], [44, -10, 5, -4], [-46, 4, 17, -2]]
