
# q-expansion of newform 5292.2.i.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, 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 = 5292
weight = 2
poly_data = [3, -12, 19, -15, 10, -3, 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, 0], 1], [[2, -1, 1, 0, 0, 0], 1], [[6, -18, 5, -8, 1, -1], 3], [[3, -5, 6, -2, 1, 0], 1], [[9, -21, 19, -16, 5, -2], 3], [[-9, 30, -22, 19, -5, 2], 3]]

hecke_ring_character_values = [[2647, [1, 0, 0, 0, 0, 0]], [785, [-1, 0, 0, 0, 1, 0]], [1081, [-1, 0, 0, 0, 1, 0]]]
aps_data = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0], [1, 0, -2, 0, -1, -1], [-1, 0, 2, 0, 1, 2], [0, 2, -1, -1, 1, -2], [0, 0, -1, 0, 0, 2], [0, -1, -1, -1, 4, 1], [0, 3, -1, -1, 1, -3], [0, 3, 0, 0, 0, 0], [2, 0, -2, 0, -2, 1], [-1, 0, 2, 0, 1, -1], [0, -1, 4, 4, 0, 1], [-8, -2, 0, -1, 0, 0], [0, -1, 1, 1, 2, 1], [-11, -1, 0, -1, 0, 0], [4, 7, 0, -1, 0, 0], [3, 2, 0, 1, 0, 0], [-3, 5, 0, 3, 0, 0], [0, -2, -1, -1, 0, 2], [-4, -4, 0, 1, 0, 0], [0, 2, -1, -1, 7, -2], [5, 0, -4, 0, -5, -1], [0, -1, -5, -5, 1, 1], [4, 0, 1, 0, -4, 0], [0, 3, -3, -3, 4, -3], [9, 0, 0, 0, -9, 6], [0, -6, -3, -3, -4, 6], [0, 0, -6, 0, 0, 2], [3, 3, 0, 6, 0, 0], [0, -3, -1, -1, 1, 3], [-8, 0, 4, 0, 8, -3], [-2, 0, -1, 0, 2, 2], [0, 3, 0, 0, 3, -3], [-1, 0, -3, 0, 1, 3], [-4, 0, 0, -3, 0, 0], [-3, 0, -1, 0, 3, 2], [-1, 0, 2, 0, 1, 4], [-6, 1, 0, 6, 0, 0], [0, 0, -3, -3, 0, 0], [-6, 3, 0, -6, 0, 0], [-8, -5, 0, 2, 0, 0], [-5, -1, 0, -5, 0, 0], [5, 7, 0, 1, 0, 0], [0, -5, -7, -7, -4, 5], [15, 0, -4, 0, -15, -4], [0, -4, 4, 4, -9, 4], [19, 0, 1, 0, -19, 1], [0, -4, 4, 4, -11, 4], [-2, 0, -8, 0, 2, -7], [5, 0, -10, 0, -5, 2], [12, 0, -7, 0, -12, -1], [7, 4, 0, -7, 0, 0], [0, 4, -10, -10, -2, -4], [-2, 0, 1, 0, 2, 10], [0, -5, 1, 1, 11, 5], [-11, 0, -2, 0, 11, 1], [-11, 0, 3, 0, 11, 0], [0, 2, -1, -1, -23, -2], [2, 1, 0, 2, 0, 0], [-7, 0, -1, 0, 7, -13], [-7, -2, 0, -7, 0, 0], [-11, 5, 0, -10, 0, 0], [1, -9, 0, 9, 0, 0], [-9, -3, 0, 0, 0, 0], [-1, 6, 0, 3, 0, 0], [-15, 0, 9, 0, 15, 3], [8, 8, 0, 7, 0, 0], [0, -2, 2, 2, 24, 2], [0, 0, -3, 0, 0, 9], [9, 0, 9, 0, -9, 8], [-6, 0, -4, 0, 6, -7], [0, -5, -4, -4, 12, 5], [15, 17, 0, -5, 0, 0], [0, 1, -6, -6, 6, -1], [-20, 0, 1, 0, 20, 6], [6, 0, -6, 0, -6, -3], [0, -7, -2, -2, -19, 7], [-6, 4, 0, 2, 0, 0], [-10, 0, 5, 0, 10, 5], [0, -4, 7, 7, 2, 4], [0, -11, 5, 5, -17, 11], [21, -2, 0, -4, 0, 0], [-5, -5, 0, -1, 0, 0], [-12, 8, 0, -6, 0, 0], [21, 4, 0, 3, 0, 0], [-4, 10, 0, -1, 0, 0], [0, 4, 7, 7, -13, -4], [-4, 0, -9, 0, 4, -15], [-4, 0, -10, 0, 4, 7], [14, 0, 5, 0, -14, 0], [0, 3, 3, 3, -11, -3], [-28, 0, 2, 0, 28, -1], [0, -6, 0, 0, -16, 6], [11, 5, 0, 4, 0, 0], [0, 1, 11, 11, 16, -1], [0, 6, -12, -12, -9, -6], [13, 0, -3, 0, -13, 3], [-13, 0, 8, 0, 13, 2], [0, -5, -7, -7, -2, 5], [0, -9, 11, 11, 1, 9], [-21, -19, 0, 6, 0, 0], [15, -6, 0, 12, 0, 0], [11, -7, 0, 7, 0, 0], [0, 13, 5, 5, 6, -13], [0, -5, -6, -6, -3, 5], [0, 0, 3, 0, 0, -12], [2, 2, 0, -2, 0, 0], [0, -3, 0, 0, -23, 3], [0, 0, 6, 6, -3, 0], [0, -6, -6, -6, 9, 6], [-23, 0, 4, 0, 23, -1], [0, 0, 13, 0, 0, 13], [-15, 7, 0, 2, 0, 0], [-34, 0, 5, 0, 34, -3], [13, 0, 3, 0, -13, 15], [0, 6, 3, 3, 30, -6], [0, 8, 7, 7, 17, -8], [0, 8, -13, -13, -14, -8], [23, -5, 0, 5, 0, 0], [0, -5, 2, 2, 17, 5], [-21, 9, 0, -3, 0, 0], [0, 20, -2, -2, 2, -20], [11, -3, 0, 0, 0, 0], [16, -4, 0, 2, 0, 0], [6, -2, 0, -10, 0, 0], [5, 0, 11, 0, -5, -7], [0, 11, -8, -8, 10, -11], [0, 2, 10, 10, 23, -2], [0, 5, 1, 1, -7, -5], [-9, 0, 3, 0, 9, 12], [0, 4, 5, 5, 28, -4], [3, -6, 0, -15, 0, 0], [0, 2, 14, 14, -2, -2], [14, 0, -3, 0, -14, -9], [0, 8, 0, 0, 21, -8], [12, -3, 0, -12, 0, 0], [11, 0, -1, 0, -11, -4], [0, -18, -1, -1, -17, 18], [22, -3, 0, 15, 0, 0], [6, -4, 0, -9, 0, 0], [16, 0, 0, 0, 0, 0], [5, -19, 0, -5, 0, 0], [0, 0, -3, -3, 8, 0], [0, 6, -14, -14, -19, -6], [0, -2, 11, 11, 2, 2], [20, 0, -7, 0, -20, -7], [0, -6, 0, 0, 25, 6], [27, 0, -3, 0, -27, -10], [0, -14, -1, -1, -27, 14], [26, 5, 0, -2, 0, 0], [-18, -11, 0, -4, 0, 0], [0, -13, 7, 7, -4, 13], [9, 0, 12, 0, -9, -12], [0, -17, 5, 5, 1, 17], [-31, 0, 6, 0, 31, -3], [-25, -25, 0, 7, 0, 0], [-21, -14, 0, 5, 0, 0], [-12, 1, 0, 12, 0, 0], [-34, 9, 0, -5, 0, 0], [2, -8, 0, -8, 0, 0], [15, 0, 5, 0, -15, 2], [-17, 0, 7, 0, 17, -8], [-5, -8, 0, 8, 0, 0], [22, 0, -5, 0, -22, 7], [0, 8, 7, 7, 30, -8], [38, 0, 4, 0, -38, -8], [-9, -8, 0, -13, 0, 0], [0, 22, -7, -7, 28, -22], [9, 0, -9, 0, -9, 23], [-13, 0, 0, 0, 13, -27], [0, -6, 0, 0, 3, 6], [-33, 0, 0, 0, 33, 0], [1, -20, 0, 8, 0, 0], [11, 0, -4, 0, -11, 19], [0, -19, -8, -8, -4, 19], [0, 25, 0, 0, 0, -25], [30, 13, 0, -1, 0, 0], [20, 9, 0, -12, 0, 0], [-26, 1, 0, -7, 0, 0], [0, -12, 13, 13, -4, 12], [-32, 0, 2, 0, 32, -10], [18, 0, 9, 0, -18, -4], [-2, 5, 0, 17, 0, 0], [44, 0, -7, 0, -44, -4], [0, -5, 2, 2, 22, 5], [13, 0, -3, 0, -13, 0], [0, 15, -6, -6, 15, -15], [0, 0, -3, -3, 24, 0], [-19, 0, 21, 0, 19, 3], [0, -3, 12, 12, -6, 3], [17, 0, 9, 0, -17, 15], [-23, -3, 0, 2, 0, 0], [0, 15, -6, -6, 18, -15], [-2, 15, 0, -1, 0, 0], [-2, 2, 0, -5, 0, 0], [-12, -22, 0, 7, 0, 0], [0, -6, 15, 15, 27, 6], [-17, 0, 10, 0, 17, 16], [-5, -8, 0, -10, 0, 0], [0, 24, 6, 6, 9, -24], [0, 5, 13, 13, 27, -5], [-29, 0, 10, 0, 29, -5], [-25, -1, 0, 4, 0, 0], [0, 5, 16, 16, 23, -5], [2, 0, 10, 0, -2, 10], [0, -7, 7, 7, 26, 7], [0, -14, 2, 2, 16, 14], [7, 23, 0, -8, 0, 0], [1, 0, -12, 0, -1, -3], [28, 0, 13, 0, -28, 6], [0, 2, -8, -8, 14, -2], [29, 3, 0, -2, 0, 0], [-1, 8, 0, -11, 0, 0], [-25, -21, 0, 9, 0, 0], [38, 1, 0, 11, 0, 0], [-18, 0, -12, 0, 18, 7], [31, 0, -5, 0, -31, -10], [31, 0, 7, 0, -31, 17], [0, 21, -15, -15, 23, -21], [2, 0, -12, 0, -2, 0], [0, 12, 0, 0, -24, -12], [0, 0, 16, 0, 0, 19], [14, 0, 2, 0, -14, 14], [0, -12, 3, 3, 13, 12], [1, 27, 0, 8, 0, 0], [0, -1, -9, -9, 0, 1], [-1, -1, 0, 4, 0, 0], [12, -9, 0, 0, 0, 0], [4, -29, 0, -16, 0, 0], [0, 6, -6, -6, 2, -6], [-26, 0, -4, 0, 26, -10], [38, 2, 0, -5, 0, 0], [0, 8, 10, 10, 36, -8], [22, 0, 10, 0, -22, 13], [0, -14, -4, -4, 12, 14], [-12, 0, -3, 0, 12, -21], [-36, 0, 6, 0, 36, 9], [40, 2, 0, -1, 0, 0], [17, 0, 8, 0, -17, 9], [15, 0, 11, 0, -15, -13], [-13, 3, 0, -6, 0, 0], [1, 0, 13, 0, -1, 7], [-6, 0, -15, 0, 6, -11], [17, 8, 0, -17, 0, 0], [31, 13, 0, 11, 0, 0], [5, -17, 0, -2, 0, 0], [-28, 18, 0, 3, 0, 0], [21, 12, 0, -12, 0, 0], [5, 0, 12, 0, -5, 27], [4, 0, 10, 0, -4, 16], [-4, -7, 0, 7, 0, 0], [0, 6, -9, -9, 17, -6], [-10, 0, 23, 0, 10, 0], [-27, 0, 3, 0, 27, -20], [0, 12, -9, -9, 16, -12], [-12, 0, -15, 0, 12, -6], [-18, 7, 0, -12, 0, 0], [9, 0, -4, 0, -9, -16], [-6, 0, 25, 0, 6, 7], [0, 4, -11, -11, -13, -4], [-7, -11, 0, 2, 0, 0], [-13, -14, 0, 2, 0, 0], [-4, -4, 0, 4, 0, 0], [4, 0, 0, -6, 0, 0], [-58, -10, 0, 7, 0, 0], [0, -13, -12, -12, -12, 13], [37, 0, 2, 0, -37, -7], [30, -15, 0, 3, 0, 0], [0, 18, 15, 15, -21, -18], [0, -22, 1, 1, 18, 22], [19, 0, -14, 0, -19, -8], [0, -10, -5, -5, -3, 10], [-47, 0, 5, 0, 47, -1], [7, 0, -8, 0, -7, -8], [0, 5, 5, 5, -14, -5], [-34, 0, -13, 0, 34, -10], [-32, 0, -10, 0, 32, -16], [38, -1, 0, -2, 0, 0], [21, 30, 0, 0, 0, 0], [7, -17, 0, -4, 0, 0], [0, -9, 9, 9, -30, 9], [0, 13, 5, 5, 29, -13], [0, -10, 7, 7, -1, 10], [10, 0, 1, 0, -10, 26], [0, -26, 17, 17, 4, 26], [35, 0, -13, 0, -35, -15], [-7, 0, 13, 0, 7, 1], [5, -22, 0, -11, 0, 0], [0, 0, 9, 0, 0, -15], [0, -20, -4, -4, -2, 20], [0, 12, -3, -3, -36, -12], [-16, 0, -1, 0, 16, 16], [0, 31, 5, 5, -10, -31], [28, -17, 0, 8, 0, 0], [-19, 15, 0, -3, 0, 0], [0, 10, 26, 26, 22, -10], [-48, 0, 12, 0, 48, -9], [0, -10, 4, 4, 23, 10], [0, -4, 4, 4, -23, 4], [6, 0, 3, 0, -6, 3], [0, 33, -3, -3, 5, -33], [14, 0, -7, 0, -14, -4], [0, 6, -6, -6, -11, -6], [23, -15, 0, 15, 0, 0], [24, 0, -3, 0, -24, -7], [-1, 0, -5, 0, 1, 13], [0, -10, -10, -10, -11, 10], [7, 0, 6, 0, -7, 27], [0, 27, 0, -18, 0, 0], [0, -6, -13, -13, -17, 6], [30, 19, 0, -6, 0, 0], [-3, -20, 0, 17, 0, 0], [31, 8, 0, 23, 0, 0], [0, 5, -11, -11, -9, -5], [0, -14, 8, 8, 28, 14], [0, -11, 0, 0, 0, 0], [0, 4, -16, -16, -67, -4], [26, 0, 8, 0, -26, 8], [2, 0, 1, 0, -2, 31], [0, 22, 17, 17, 18, -22], [25, 19, 0, 5, 0, 0], [-21, 8, 0, -26, 0, 0], [-34, 0, 5, 0, 34, 7], [7, 0, -21, 0, -7, 24], [-6, 0, -1, 0, 6, -1], [3, 32, 0, -11, 0, 0], [-29, -9, 0, -4, 0, 0], [4, 27, 0, -1, 0, 0], [-50, 8, 0, -26, 0, 0], [-51, 8, 0, -6, 0, 0], [0, -14, -28, -28, -11, 14], [-16, 0, -19, 0, 16, 30], [0, -17, -10, -10, -6, 17], [2, 9, 0, -5, 0, 0], [-38, -11, 0, 14, 0, 0], [0, -2, 1, 1, -4, 2], [15, 0, 11, 0, -15, -4], [-28, 0, -9, 0, 28, 18], [-5, 0, 12, 0, 5, -6], [0, 15, -12, -12, -6, -15], [42, 0, 6, 0, -42, -15], [0, -1, 7, 7, -37, 1], [16, 25, 0, -16, 0, 0], [-21, 0, 0, 15, 0, 0], [0, 1, 8, 8, 5, -1], [54, -14, 0, 2, 0, 0], [0, -4, -8, -8, -25, 4], [12, 0, 9, 0, -12, 30], [0, 26, 1, 1, 36, -26], [0, 26, -26, -26, -12, -26], [16, 0, -35, 0, -16, -23], [50, 0, -1, 0, -50, -1], [0, 11, -35, -35, -26, -11], [-33, -1, 0, -9, 0, 0], [0, -19, -15, -15, -30, 19], [0, -35, 20, 20, -35, 35], [0, 6, -26, -26, -22, -6], [0, 10, 3, 3, 12, -10], [0, -6, 24, 24, 20, 6], [-15, -7, 0, -33, 0, 0], [0, 41, -12, -12, 48, -41], [68, 16, 0, -5, 0, 0], [0, -18, 6, 6, -28, 18], [26, 36, 0, -6, 0, 0], [0, 5, 13, 13, 32, -5], [0, -1, 7, 7, 62, 1], [-6, 29, 0, 7, 0, 0], [-9, 0, 15, 0, 9, -8], [-3, 0, -11, 0, 3, -5], [0, 3, -21, -21, 15, -3], [0, -6, 14, 14, 40, 6], [-48, 14, 0, -11, 0, 0], [-52, 0, -6, 0, 52, -21], [12, -21, 0, 0, 0, 0], [-25, -11, 0, 4, 0, 0], [0, -14, -13, -13, -36, 14], [8, 0, 8, 0, -8, -15], [0, 10, -10, -10, 26, -10], [-61, 0, 11, 0, 61, -7], [36, 0, -24, 0, -36, -1], [16, -3, 0, 33, 0, 0], [-9, 0, 9, 0, 9, 27], [55, 0, -4, 0, -55, 20], [0, 8, 0, 0, -36, -8], [-21, 0, 11, 0, 21, 5], [-22, 22, 0, -10, 0, 0], [-1, 0, 15, 0, 1, 6], [9, 0, 0, 0, -9, -11], [0, 6, -30, -30, -23, -6], [-41, -5, 0, 11, 0, 0], [0, -20, -15, -15, 9, 20], [-17, 5, 0, 19, 0, 0], [4, 5, 0, 26, 0, 0], [-45, -24, 0, -6, 0, 0], [0, -11, -10, -10, 24, 11], [0, -26, -21, -21, 12, 26], [13, 0, -5, 0, -13, 25], [18, -10, 0, 30, 0, 0], [0, 23, -14, -14, 24, -23], [-16, 0, -16, 0, 16, 35], [0, -7, 25, 25, -17, 7], [0, 23, -21, -21, 3, -23], [0, 7, 14, 14, 22, -7], [9, 0, 11, 0, -9, 29], [-19, 0, 12, 0, 19, 27], [0, 35, -17, -17, 32, -35], [31, -4, 0, 19, 0, 0], [-23, 9, 0, -7, 0, 0], [26, 28, 0, -4, 0, 0], [-19, -29, 0, -14, 0, 0], [5, 25, 0, 1, 0, 0], [-2, -14, 0, 29, 0, 0], [15, 0, -1, 0, -15, -28], [24, 0, -24, 0, -24, -14], [8, 0, 8, 0, -8, 33], [-83, 0, -1, 0, 83, 2], [-43, -1, 0, 4, 0, 0], [0, -1, 9, 9, -15, 1], [9, 0, -36, 0, -9, -23], [49, 0, 3, 0, -49, 3], [0, 5, -7, -7, 4, -5], [-4, 0, 20, 0, 4, 29], [66, 25, 0, -10, 0, 0], [-18, -14, 0, -24, 0, 0], [0, 22, 0, 12, 0, 0], [-51, 9, 0, 0, 0, 0], [0, 18, -15, -15, 39, -18], [-44, 0, -8, 0, 44, -34]]
