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