
# q-expansion of newform 1053.2.a.f, downloaded from the LMFDB on 13 September 2025.

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