
# q-expansion of newform 1950.2.bc.f, downloaded from the LMFDB on 19 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 = 1950
weight = 2
poly_data = [1, 0, 0, 0, -1, 0, 0, 0, 1]

# The basis for the coefficient ring is just the power basis
# in the root of the defining polynomial above.
hecke_ring_character_values = [[1301, [1, 0, 0, 0, 0, 0, 0, 0]], [1327, [1, 0, 0, 0, 0, 0, 0, 0]], [301, [0, 0, 0, 0, 1, 0, 0, 0]]]
aps_data = [[0, 0, -1, 0, 0, 0, 0, 0], [1, 0, 0, 0, -1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, -1, -1, -1], [-1, 0, 2, -1, -1, -1, 0, 1], [0, 3, 0, 0, 0, -4, 0, 0], [0, -3, 0, 3, -1, 3, 0, -3], [2, -1, 0, 1, -1, -1, 0, 1], [-1, -1, -1, 4, 1, -3, 2, -3], [1, -4, 1, 5, -1, -1, -2, -1], [-2, -2, 0, 2, 4, -3, -1, -5], [2, 3, -4, 5, 2, 2, 0, -2], [0, -1, -5, -4, 0, -3, 0, 3], [0, 3, -2, -5, 1, -5, -2, 3], [-2, 3, 0, -3, 4, 1, 4, 4], [1, -1, 4, -1, 0, 2, -2, -1], [-2, -2, -3, 4, 1, -4, 3, 2], [0, 0, 4, -3, -4, -3, 4, 0], [-2, 4, 6, 4, -2, 0, 0, 0], [10, 3, -1, -1, -5, 1, 1, -3], [2, 0, 0, 0, -4, -4, 3, -4], [-1, 3, 0, 3, 0, -6, 0, 3], [2, -1, 0, 1, -4, -3, 1, -4], [2, -1, 1, -6, 2, -5, 0, 5], [-2, 8, 0, 2, 1, -2, 0, -8], [-11, 0, -1, -1, 11, 1, 2, 1], [-3, -3, 0, -3, 0, 4, 0, -1], [7, 0, 1, -6, -7, 6, -2, 6], [4, 1, 0, -1, -8, -4, 10, -3], [0, -4, 0, 0, 4, 0, 0, -4], [0, 8, 2, -8, 0, 0, -4, 0], [-5, 2, 10, 2, 0, -4, -5, 2], [-6, -1, 9, -4, 3, 4, -9, 1], [0, 3, -3, -4, -3, -4, -3, 3], [0, 1, 1, 5, 0, -5, -1, -1], [-5, -7, 0, 7, 10, 2, 4, -5], [0, 7, -8, 7, 0, 4, 4, -11], [-4, 2, 3, -1, 2, 1, -3, -2], [3, -7, -5, -13, 3, -6, 0, 6], [0, -10, -2, 4, -2, 4, -2, -10], [-3, -10, 2, 7, 3, 3, -4, 3], [0, -10, -4, -10, 0, 3, 2, 7], [0, -3, -3, 1, 3, 1, -3, -3], [0, 0, 3, -4, 0, -4, 0, 4], [-1, -8, 11, -5, -1, 3, 0, -3], [0, 6, 2, -1, 5, -1, 2, 6], [-1, -5, 0, 7, 1, -2, 0, -2], [7, 1, 6, 2, 7, 1, 0, -1], [2, -9, -8, -6, -1, 6, 8, 9], [-6, 10, 0, -10, 12, -1, 8, 9], [4, 8, -12, 8, 0, -6, 6, -2], [-1, 1, 0, -1, 2, 6, 15, 7], [10, -2, 3, -6, -5, 6, -3, 2], [0, 9, -4, 2, -3, 2, -4, 9], [-1, -3, 4, 7, 1, -4, -8, -4], [3, 7, 9, -5, -3, -2, -18, -2], [0, -4, -6, 3, -13, 3, -6, -4], [-1, -10, 5, -3, -1, 7, 0, -7], [0, 2, 8, -3, -4, -3, 8, 2], [-8, 3, 0, -3, 16, -2, -11, 1], [-4, 7, 1, -2, 4, -5, -2, -5], [-14, 2, 2, 1, 7, -1, -2, -2], [-11, 9, 0, -9, 22, 1, 9, 10], [1, 12, 2, 12, 0, -11, -1, -1], [7, 4, 4, 4, 0, 8, -2, -12], [-8, -2, 0, 2, 16, -11, -3, -13], [12, 2, -13, 3, -6, -3, 13, -2], [-3, 16, -10, 16, 0, -14, 5, -2], [0, -3, -9, -4, 0, -4, -9, -3], [-2, 9, -4, 12, -2, 3, 0, -3], [0, 7, 11, 12, 0, 5, 0, -5], [-4, -12, 0, 12, 8, 8, -4, -4], [3, -2, 17, 1, -3, 1, -34, 1], [0, 1, -12, -9, 0, -9, -12, 1], [-10, 10, 6, 8, -10, -2, 0, 2], [6, -4, -7, 9, -3, -9, 7, 4], [-13, 11, 6, 11, 0, -3, -3, -8], [8, 12, 12, 6, -4, -6, -12, -12], [6, 2, 10, 4, 6, 2, 0, -2], [6, 0, -17, -8, -3, 8, 17, 0], [-11, -10, 12, -7, 11, 17, -24, 17], [-6, 4, 0, -4, 12, 13, -16, 17], [-3, -3, -11, 13, -3, 16, 0, -16], [0, -4, -3, 8, 6, 8, -3, -4], [-4, 0, 0, -8, 4, 8, 0, 8], [23, -1, 0, -1, 0, -5, 0, 6], [14, 3, 6, 7, -7, -7, -6, -3], [7, 4, 16, 8, 7, 4, 0, -4], [8, -1, 11, -1, -4, 1, -11, 1], [5, -3, 0, 3, -10, 14, 2, 11], [-1, -3, 16, -3, 0, -7, -8, 10], [0, 8, 2, 14, 0, 6, 0, -6], [4, -5, -17, 5, -2, -5, 17, 5], [-17, -4, -8, 5, 17, -1, 16, -1], [-1, 12, 0, -12, 2, -7, 0, 5], [0, 12, -1, 9, 5, 9, -1, 12], [1, -1, 0, 20, 1, 21, 0, -21], [-14, 4, 0, 4, 0, 6, 0, -10], [-20, -6, 0, 0, 20, 6, 0, 6], [-4, 17, 0, -17, 8, -6, 6, 11], [-12, 3, -18, 3, 0, -20, 9, 17], [-4, -4, -16, 14, -4, 18, 0, -18], [0, 7, 2, 0, 3, 0, 2, 7], [9, 12, -7, -3, -9, -9, 14, -9], [5, -9, -14, -9, 0, 11, 7, -2], [-6, -20, 0, 20, 12, 10, 3, -10], [11, 8, 24, -3, 11, -11, 0, 11], [0, -17, 0, 17, 0, 20, 1, 3], [-11, 13, 2, 13, 0, -12, -1, -1], [4, -20, -8, 10, -4, 10, 16, 10], [0, 15, 3, 0, 3, 0, 3, 15], [12, 8, 12, 1, 12, -7, 0, 7], [-4, 10, -8, -4, 2, 4, 8, -10], [-8, -2, 0, 2, 16, 2, 12, 0], [0, 6, -6, 4, 0, -4, 6, -6], [0, -19, -3, 8, -7, 8, -3, -19], [16, -4, 4, -2, -8, 2, -4, 4], [-9, 3, 1, -7, 9, 4, -2, 4], [12, -17, 5, 15, -12, 2, -10, 2], [0, 3, -14, 2, -3, 2, -14, 3], [12, 4, -2, -2, 12, -6, 0, 6], [6, -10, -5, 10, -6, 0, 10, 0], [-8, 4, -28, 4, 0, 2, 14, -6], [-16, -9, 17, -16, 8, 16, -17, 9], [-2, 8, -28, 4, -2, -4, 0, 4], [16, 0, 22, 0, 0, 15, -11, -15], [4, -2, 4, 15, -2, -15, -4, 2], [0, -6, 13, -9, 5, -9, 13, -6], [3, -17, -30, -17, 0, 15, 15, 2], [6, 12, 0, -12, -12, -9, 16, 3], [-1, -12, -19, -17, -1, -5, 0, 5], [0, -16, -4, -20, 0, -4, 0, 4], [3, 24, 1, -19, -3, -5, -2, -5], [4, 4, 20, -3, -4, -1, -40, -1], [-6, 7, -20, 13, 3, -13, 20, -7], [-13, -20, 21, -26, -13, -6, 0, 6], [40, 12, -4, 2, -20, -2, 4, -12], [16, -6, 21, -17, -8, 17, -21, 6], [0, -11, 11, -12, -15, -12, 11, -11], [-15, 21, 8, 5, 15, -26, -16, -26], [2, -18, 0, 18, -4, 4, -6, -14], [-10, 10, -6, 0, -10, -10, 0, 10], [0, 18, 6, -25, 13, -25, 6, 18], [-12, 5, 0, -5, 24, 5, 1, 10], [-8, -4, 16, 10, 8, -6, -32, -6], [26, -1, 23, -5, -13, 5, -23, 1], [-2, 4, 0, -4, 4, -4, -16, 0], [5, 15, 10, 15, 0, 19, -5, -34], [-6, -35, 6, -35, 0, 28, -3, 7], [3, 12, 0, -12, -6, 7, -5, 19], [-24, -11, -10, 1, 12, -1, 10, 11], [-11, -11, 2, -1, 11, 12, -4, 12], [6, -14, 12, -14, 0, -22, -6, 36], [16, 8, 12, -18, -16, 10, -24, 10], [-11, -7, 8, -9, 11, 16, -16, 16], [13, 13, -2, 13, 0, -14, 1, 1], [0, 1, -3, -21, 0, -21, -3, 1], [0, -4, -6, -2, 0, 2, 6, 4], [-21, -12, -16, -12, 0, 20, 8, -8], [-4, 0, 0, 0, 8, -18, -26, -18], [-11, 12, -8, -5, -11, -17, 0, 17], [0, 9, 6, 13, 5, 13, 6, 9], [-2, 12, 0, -12, 4, -8, 24, 4], [0, 6, 5, 16, 5, 16, 5, 6], [0, 4, 44, 8, 0, 4, 0, -4], [-8, -8, 0, 8, 16, -12, 20, -20], [-9, 33, -2, -18, 9, -15, 4, -15], [0, -20, 6, 8, 26, 8, 6, -20], [-1, -10, 0, 10, 2, -8, 28, -18], [1, -13, 4, -13, 0, -4, -2, 17], [-4, 2, 0, -2, 8, 2, 14, 4], [8, -22, -12, 1, -4, -1, 12, 22], [0, 8, -2, -6, -16, -6, -2, 8], [10, 8, 11, 28, -5, -28, -11, -8], [9, -19, 6, -19, 0, -15, -3, 34], [0, -4, 1, 3, -20, 3, 1, -4], [-8, 30, 10, 16, -8, -14, 0, 14], [-5, -3, 0, 3, 10, -5, -11, -8], [-3, -12, 9, -3, 3, 15, -18, 15], [-18, -1, 10, 9, 18, -8, -20, -8], [11, -5, 0, 5, -22, 5, 23, 0], [4, -13, 14, -13, 0, -1, -7, 14], [12, -27, -16, -27, 0, 7, 8, 20], [-9, 19, 0, -19, 18, -5, 33, 14], [0, 0, -34, 0, 0, 0, 0, 0], [0, 0, 4, 1, 19, 1, 4, 0], [16, -22, -24, -22, 0, 5, 12, 17], [0, -33, 0, 33, 0, 8, -5, -25], [9, -14, -26, -4, 9, 10, 0, -10], [-18, -6, -35, -1, 9, 1, 35, 6], [0, -6, -17, 14, -9, 14, -17, -6], [28, -13, -21, -12, -14, 12, 21, 13], [12, 1, 30, 1, 0, 12, -15, -13], [5, -19, 2, -20, 5, -1, 0, 1], [0, 19, 4, 16, -13, 16, 4, 19], [-17, 0, 9, 23, 17, -23, -18, -23], [5, 12, 0, -12, -10, 0, -25, 12], [0, -20, 16, 7, 12, 7, 16, -20], [13, 4, 0, -4, -26, -19, 2, -15], [3, 16, -6, 16, 0, 19, 3, -35], [16, 17, 9, -3, -8, 3, -9, -17], [0, 6, 26, 2, 10, 2, 26, 6], [2, -14, -2, 8, 2, 22, 0, -22], [19, 14, -14, 14, 0, -22, 7, 8], [0, 4, 2, -18, 0, -22, 0, 22], [-3, -3, 24, -4, 3, 7, -48, 7], [18, -10, 0, 10, -36, 10, 12, 0], [0, -17, 17, -8, -2, -8, 17, -17], [-2, 9, 25, 0, -2, -9, 0, 9], [0, -4, 3, -9, 16, -9, 3, -4], [0, -16, 3, 28, 0, -12, -6, -12], [10, -36, -18, -36, 0, 27, 9, 9], [-17, -11, 12, -4, 17, 15, -24, 15], [2, 11, -8, -8, -1, 8, 8, -11], [36, 0, 16, -8, -18, 8, -16, 0], [-11, -28, 0, 28, 22, 22, 12, -6], [-7, -7, 28, -7, 0, 12, -14, -5], [0, -6, 0, -12, -4, -12, 0, -6], [-5, 1, 27, 8, -5, 7, 0, -7], [-10, 4, 0, -4, 20, -7, -3, -3], [-8, 19, -12, -31, 8, 12, 24, 12], [-20, -2, 0, 2, 40, -9, 7, -11], [15, 26, 0, -26, -30, -5, -18, 21], [-8, -23, 29, -15, 4, 15, -29, 23], [7, -30, -2, 19, -7, 11, 4, 11], [-24, 11, -8, 11, 0, -12, 4, 1], [23, -6, 23, 11, -23, -5, -46, -5], [0, -14, -10, 4, 0, 4, -10, -14], [0, -31, 11, 10, 3, 10, 11, -31], [1, 0, 0, 0, -2, 24, -13, 24], [0, 17, -2, -27, 0, 10, 4, 10], [31, -21, -4, 3, -31, 18, 8, 18], [-6, -8, -40, -2, -6, 6, 0, -6], [15, -9, 10, -9, 0, -7, -5, 16], [-2, -8, -52, -8, 0, 14, 26, -6], [-17, -5, 0, 5, 34, 12, 11, 7], [-22, -12, 35, -10, 11, 10, -35, 12], [-33, 4, -1, 5, -33, 1, 0, -1], [0, 17, -9, 12, 24, 12, -9, 17], [15, -19, -5, -5, -15, 24, 10, 24], [11, 0, -8, 3, 11, 3, 0, -3], [-12, 4, 18, 16, 12, -20, -36, -20], [0, 10, -14, 2, -8, 2, -14, 10], [-6, 17, 30, 19, -6, 2, 0, -2], [48, 10, 1, 17, -24, -17, -1, -10], [-19, 8, -6, 8, 0, 13, 3, -21], [-16, -13, 27, 3, 8, -3, -27, 13], [-23, -2, 15, 0, -23, 2, 0, -2], [24, 28, -9, 15, -12, -15, 9, -28], [-14, 10, 12, -16, 14, 6, -24, 6], [12, -15, -2, -17, 12, -2, 0, 2], [-6, 9, 5, 14, -6, 5, 0, -5], [-17, 1, 0, -1, 34, 2, 9, 3], [8, -22, 1, 14, -8, 8, -2, 8], [10, -4, -20, -4, 0, 12, 10, -8], [8, -17, 17, 4, -4, -4, -17, 17], [0, -2, 28, -13, -16, -13, 28, -2], [3, -4, -3, -17, 3, -13, 0, 13], [-35, -13, 18, -13, 0, 9, -9, 4], [-32, 14, -39, -14, 16, 14, 39, -14], [-27, 19, 8, 19, 0, -2, -4, -17], [6, -6, 9, 29, -6, -23, -18, -23], [6, 26, 0, -26, -12, 12, -16, 38], [10, 21, -20, -15, -10, -6, 40, -6], [0, 8, 23, 27, 0, -27, -23, -8], [0, 16, 4, 12, -20, 12, 4, 16], [16, 12, 24, 8, -8, -8, -24, -12], [9, -13, 0, 13, -18, -13, 11, -26], [26, 3, 30, 1, -13, -1, -30, -3], [0, 4, 6, -42, -18, -42, 6, 4], [-26, 14, -20, 14, 0, 20, 10, -34], [-4, -19, 0, 19, 8, -18, 5, -37], [5, 4, 21, 26, 5, 22, 0, -22], [0, 7, -3, -7, -2, -7, -3, 7], [0, -24, 7, 10, -13, 10, 7, -24], [-6, -10, 26, -24, -6, -14, 0, 14], [34, 14, -25, 10, -17, -10, 25, -14], [8, -20, 0, 20, -16, 34, 22, 14], [-14, 34, 12, 22, 7, -22, -12, -34], [0, -1, -11, 24, 42, 24, -11, -1], [16, 16, 2, 22, -16, -38, -4, -38], [-9, -5, -44, -14, -9, -9, 0, 9], [11, -24, -18, -24, 0, -3, 9, 27], [8, -17, -32, -9, 8, 8, 0, -8], [-2, -1, 0, 1, 4, -12, 7, -13], [19, 11, 14, 11, 0, 8, -7, -19], [-24, 14, -24, 14, 0, -26, 12, 12], [-19, 21, 0, -21, 38, -24, 10, -3], [6, -6, -10, 3, -3, -3, 10, 6], [0, 18, 9, -15, 50, -15, 9, 18], [-41, 18, -11, -9, 41, -9, 22, -9], [0, 3, -7, 16, -14, 16, -7, 3], [-16, -3, -17, 6, -16, 9, 0, -9], [-10, -30, -25, 6, 5, -6, 25, 30], [0, -11, -8, -25, -6, -25, -8, -11], [-39, -7, 0, -7, 0, 18, 0, -11], [40, 12, -10, 12, 0, -5, 5, -7], [-27, 3, 12, 0, 27, -3, -24, -3], [-18, 22, 1, -29, 18, 7, -2, 7], [1, 13, -38, -9, 1, -22, 0, 22], [0, 12, -14, -4, 22, -4, -14, 12], [11, 23, 0, -23, -22, -20, -26, 3], [-44, 1, 15, -9, 44, 8, -30, 8]]
