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