
# q-expansion of newform 6012.2.a.f, downloaded from the LMFDB on 18 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 = 6012
weight = 2
poly_data = [1, 5, 3, -6, -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, 0, 0, 0], 1], [[0, 1, 0, 0, 0], 1], [[1, 3, -5, -1, 1], 1], [[4, 3, -6, -1, 1], 1], [[-6, -11, 11, 3, -2], 1]]

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