
# q-expansion of newform 8405.2.a.f, downloaded from the LMFDB on 13 July 2026.

# 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 = 8405
weight = 2
poly_data = [-3, -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, -1], [3, 0], [1, 0], [2, -1], [3, 0], [2, -3], [1, 2], [0, 3], [3, -2], [2, 1], [-3, 3], [0, -3], [0, 0], [-4, 5], [9, 1], [4, 2], [-10, 3], [-5, -2], [2, 3], [-11, 2], [-3, 3], [-7, -1], [-7, -1], [5, -8], [-6, 6], [7, 1], [7, -2], [6, 2], [-5, 0], [-7, 8], [4, -9], [9, -5], [-4, -8], [-6, 0], [0, -3], [-2, 4], [13, 0], [-13, 3], [4, -4], [6, 5], [9, -2], [5, -4], [6, -12], [-15, 7], [7, -7], [2, 0], [-13, -3], [14, -6], [-6, 0], [-3, 13], [0, -1], [3, 0], [3, 3], [-17, 2], [-2, 11], [-3, 6], [-22, 1], [13, -2], [-11, 4], [11, 4], [14, 3], [15, 6], [26, -1], [4, 1], [25, -2], [-17, -4], [8, 3], [14, 8], [-10, -5], [4, -2], [7, 1], [15, 6], [-13, 11], [-5, 4], [3, 0], [-2, 2], [9, 1], [21, -7], [1, 2], [-19, 11], [-17, -2], [7, -14], [7, -4], [-6, -15], [11, -5], [-21, 6], [-6, -1], [-2, 0], [5, 2], [16, -14], [-13, 1], [-15, 2], [0, -14], [-14, 5], [17, -8], [-15, -4], [0, 3], [-18, 8], [-5, 0], [19, -6], [28, 4], [-10, -1], [22, 0], [5, 6], [-18, -10], [-31, -1], [37, -4], [-13, 4], [7, -20], [19, 7], [19, -4], [-15, 0], [-10, 6], [-2, -7], [28, -11], [3, -6], [1, 6], [-36, 3], [-21, -1], [-3, -16], [2, 5], [11, 5], [-16, 0], [-9, 2], [-35, 1], [-3, -10], [4, 6], [6, 14], [20, -12], [28, -6], [-2, 15], [-39, 3], [-10, -9], [-3, 12], [-2, -11], [44, 0], [-21, -10], [24, -3], [7, 8], [27, 3], [38, -6], [44, -2], [20, 14], [31, -12], [-10, -7], [0, -9], [-33, 18], [-26, 12], [-16, -6], [-29, 14], [-21, -15], [-25, 0], [-35, 4], [-32, 14], [7, -14], [-3, -12], [27, 0], [-3, 9], [-11, 18], [15, 9], [2, -10], [-12, -3], [16, -24], [47, -1], [-19, -12], [-2, 20], [-4, 24], [-28, -10], [-22, 29], [-7, 7], [-14, 4], [18, -26], [13, -26], [-11, 14], [3, -9], [37, 4], [14, 15], [-12, -3], [3, 11], [-22, 23], [-17, 7], [-24, -5], [-4, -15], [3, 8], [-36, 20], [-17, -18], [13, -12], [-1, 11], [29, 11], [6, -4], [37, -9], [-24, 31], [-16, 29], [33, -26], [22, -28], [-25, -4], [23, -3], [-48, 3], [-27, 14], [8, 9], [-26, 15], [12, -10], [-22, 27], [0, 16], [11, 8], [-9, -22], [31, -12], [1, 19], [-3, 16], [-29, 19], [28, -2], [-6, -12], [22, -11], [-26, 26], [-16, 13], [-16, 12], [-13, -19], [-30, -2], [48, -16], [3, -16], [-3, -18], [12, -18], [-37, -14], [37, 7], [-30, 18], [2, -6], [6, 12], [31, -9], [20, -36], [17, 3], [17, -2], [-71, 1], [5, 8], [24, -36], [-3, 24], [21, -13], [12, -2], [-2, 9], [4, -16], [23, 15], [-24, -18], [17, -12], [-17, 20], [22, 6], [9, 4], [-36, -3], [-45, -12], [-24, -10], [38, 5], [-33, 12], [35, -18], [29, -25], [-11, 14], [-18, 18], [39, 5], [21, -33], [-31, 0], [39, 9], [-33, 0], [35, -30], [-32, -8], [-11, 11], [-19, 0], [-10, -13], [34, 7], [14, -37], [-11, 2], [24, -24], [-28, -12], [33, -27], [55, -4], [31, -26], [-2, 0], [-36, 3], [-3, 4], [-4, -30], [-9, 30], [-22, -7], [-10, 8], [6, 1], [-12, 25], [-37, 18], [-19, 6], [22, 25], [19, -7], [-12, 13], [41, -4], [10, -7], [44, -12], [-12, -10], [-41, -5], [26, 13], [27, 8], [0, 2], [50, 6], [-3, -24], [-45, -11], [53, 2], [45, 9], [-52, -8], [-6, 24], [-39, 22], [-31, -8], [37, -29], [31, 9], [-5, -25], [-68, -6], [35, -25], [-25, 21], [-45, 18], [37, -39], [19, -2], [1, -18], [34, 6], [-1, 13], [-7, -16], [-27, 4], [-7, 35], [20, -37], [30, -36], [19, -14], [-2, 7], [26, 4], [24, 3], [32, -13], [47, 3], [-8, -2], [25, -7], [35, -18], [-20, -4], [62, 2], [7, -30], [62, 6], [-9, 36], [52, -2], [10, -22], [-4, -6], [1, 20], [-38, 31], [49, -24], [13, -21], [48, -1], [37, -27], [-16, -3], [3, 18], [-41, -19], [-8, 31], [-5, 6], [11, -23], [-70, -10], [28, -29], [-4, -37], [36, -26], [-19, 2], [1, 1], [7, 8], [-59, 12], [25, -23], [-35, -3], [65, 6], [17, 21], [-42, 27], [-33, 0], [-15, 23], [-11, -20], [-54, 12], [27, 0], [-76, -2], [-22, -25], [43, -6], [-14, 18], [32, -26], [-40, 26], [20, 15], [-38, -14], [3, 0], [-3, -9], [-95, 3], [-43, 0], [-41, -20], [-24, 4], [-70, 10], [-67, -10], [-51, 12], [35, 18], [3, 0], [1, 31], [50, 8], [-31, 54], [28, 10], [-48, 39], [14, 30], [4, 11], [-27, -12], [39, -39], [31, 12], [25, -42], [66, 11], [23, -12], [-7, -2], [55, 5], [36, 0], [40, -38], [-30, -16], [-74, -1], [23, -50], [13, -27], [4, -32], [44, -21], [-36, 18], [4, -38], [-38, 0], [54, 10], [-27, -6], [-5, -27], [-17, 42], [-61, -6], [-46, 12], [55, -21], [22, -10], [55, -20], [4, 26], [-28, 16], [-60, -4], [7, 18], [45, -22], [-30, 16], [33, -10], [-29, -6], [21, -22]]
