
# q-expansion of newform 1764.2.l.f, downloaded from the LMFDB on 20 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 = 1764
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], [[0, 1, 0, 0, 0, 0], 1], [[6, 0, 1, 5, -1, 1], 3], [[0, -3, 2, -5, 1, -1], 3], [[6, -21, 19, -16, 5, -2], 3], [[-9, 33, -22, 19, -5, 2], 3]]

hecke_ring_character_values = [[883, [1, 0, 0, 0, 0, 0]], [785, [0, 0, 0, 0, 1, 0]], [1081, [-1, 0, 0, 0, -1, 0]]]
aps_data = [[0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 1, 1], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [-1, 2, 1, -3, 2, 0], [-2, 4, 0, -2, 1, 0], [1, -3, 0, 1, -2, 1], [0, -2, -3, -2, 0, 3], [5, -1, -2, 0, -1, 0], [-1, -3, -2, -3, -1, 2], [0, 3, 3, 3, 0, -3], [2, 1, 3, 1, 2, -3], [2, -1, 0, 2, -1, -3], [0, -1, 3, -1, 0, -3], [-1, -1, 0, -1, -7, 3], [1, -2, 0, 1, 1, 0], [11, 1, 2, 1, 11, -2], [1, -8, 0, 1, -5, 6], [-3, -2, -3, -2, -3, 3], [6, -3, -8, -2, -3, 0], [-1, -1, 0, -1, 1, 3], [1, -5, 0, 1, -5, 3], [7, 2, 1, 2, 7, -1], [5, -1, 3, -1, 5, -3], [-1, 1, 6, 1, -1, -6], [-5, 1, 1, -1, 1, 0], [7, -3, 0, 6, -3, 0], [-9, -6, -6, -6, -9, 6], [3, 3, 0, 3, 1, -9], [6, -4, 0, 6, -6, -8], [-3, 6, 9, -3, 6, 0], [-2, 1, 4, 2, 1, 0], [-4, -4, -7, 1, -4, 0], [1, 1, 0, 1, -3, -3], [3, 0, 3, 3, 0, 0], [4, -3, -6, 0, -3, 0], [-4, 0, -3, 0, -4, 3], [-3, 2, 3, 2, -3, -3], [2, -6, 0, 2, -1, 2], [6, -5, 0, 6, -12, -7], [-3, 3, 0, -3, 3, 3], [0, 6, 3, -9, 6, 0], [-2, 7, 0, -2, 10, -3], [5, 1, 6, 1, 5, -6], [-4, -1, -8, -6, -1, 0], [-7, 2, 0, -7, 3, 12], [-4, 8, 0, -4, -11, 0], [9, 4, 0, 4, 9, 0], [-20, 1, 0, -2, 1, 0], [-15, 4, 0, -8, 4, 0], [2, 7, -1, 7, 2, 1], [10, -8, 0, 10, -5, -12], [5, 7, 6, -8, 7, 0], [14, -7, -3, 11, -7, 0], [-8, 10, 6, -14, 10, 0], [-1, -1, 9, 11, -1, 0], [-1, 6, 0, -1, -10, -4], [11, -1, -3, -1, 11, 3], [8, 3, 3, -3, 3, 0], [23, -2, -1, -2, 23, 1], [2, 1, 3, 1, 2, -3], [-1, 14, 0, -1, 8, -12], [0, 7, 9, -5, 7, 0], [11, -5, 5, -5, 11, -5], [-9, 18, 0, -9, 8, 0], [0, 3, 0, 0, 9, -3], [3, 3, 0, 3, -4, -9], [9, -12, 0, 9, 6, -6], [8, 8, 15, 8, 8, -15], [-24, 2, 0, 2, -24, 0], [3, -3, -12, -6, -3, 0], [-9, -8, 1, -8, -9, -1], [-10, 4, -3, -11, 4, 0], [-16, 4, 9, 1, 4, 0], [20, -5, 12, 22, -5, 0], [-12, 6, 5, -7, 6, 0], [-19, -1, 5, 7, -1, 0], [-6, 3, -3, 3, -6, 3], [-17, -2, -9, -5, -2, 0], [-6, 4, 6, 4, -6, -6], [5, -10, 0, 5, 5, 0], [2, -4, 3, -4, 2, -3], [5, -16, 0, 5, -22, 6], [-25, 4, 6, -2, 4, 0], [1, 4, 0, 1, 4, -6], [6, -14, 0, 6, 6, 2], [-18, -3, -7, -1, -3, 0], [-1, 11, 0, -1, -3, -9], [-13, 4, 11, 4, -13, -11], [-9, 24, 0, -9, 13, -6], [-4, 7, 17, 7, -4, -17], [-19, 5, 5, -5, 5, 0], [-3, 0, 0, -3, 14, 6], [-2, 1, 0, -2, -26, 3], [16, 0, 6, 6, 0, 0], [7, 4, 9, 1, 4, 0], [-5, -11, -12, 10, -11, 0], [12, -18, 0, 12, -3, -6], [-13, -3, -6, -3, -13, 6], [-13, 2, -6, 2, -13, 6], [-2, -5, -12, -5, -2, 12], [11, -20, 0, 11, -10, -2], [21, 19, 13, 19, 21, -13], [-12, 18, 0, -12, -3, 6], [-11, 7, 0, 7, -11, 0], [5, 8, 0, 5, 1, -18], [-3, -5, -11, -5, -3, 11], [0, -12, -15, -12, 0, 15], [2, 2, 0, 2, 2, 0], [23, 3, 3, 3, 23, -3], [-9, 6, 6, -6, 6, 0], [6, 0, 0, 6, -15, -12], [-4, 3, 0, -4, -19, 5], [13, -13, 0, 26, -13, 0], [-17, 2, 9, 5, 2, 0], [-29, -5, -8, 2, -5, 0], [-3, 18, 0, -3, 16, -12], [-3, -3, 0, -3, -27, 9], [10, 7, 15, 1, 7, 0], [14, -8, 5, -8, 14, -5], [23, -5, 0, -5, 23, 0], [17, -5, -3, -5, 17, 3], [-3, 12, 0, -3, -18, -6], [-2, 22, 0, -2, 4, -18], [0, 3, 0, 0, -11, -3], [-14, -2, 2, 6, -2, 0], [-10, 8, 0, -10, 16, 12], [5, -7, -18, -7, 5, 18], [-10, -11, -3, -11, -10, 3], [13, 10, 12, -8, 10, 0], [-1, -4, 0, -1, 8, 6], [-3, 15, 0, -3, -6, -9], [-23, -5, -9, 1, -5, 0], [18, -15, -21, 9, -15, 0], [16, -14, -16, 12, -14, 0], [3, -12, 0, 3, 11, 6], [0, -8, 0, 0, -21, 8], [12, -3, -15, -3, 12, 15], [-1, 5, 0, -1, -10, -3], [-1, -17, 0, -1, -16, 19], [-7, -15, -12, 18, -15, 0], [9, -5, 0, 9, -15, -13], [-16, 0, 0, 0, -16, 0], [-10, 5, 24, 14, 5, 0], [-3, 3, 0, -3, 11, 3], [-19, 6, -8, 6, -19, 8], [-2, 2, -9, 2, -2, 9], [-13, -7, 0, 14, -7, 0], [25, 0, -6, -6, 0, 0], [-27, 10, 7, 10, -27, -7], [26, 1, 15, 13, 1, 0], [28, -2, 3, 7, -2, 0], [-14, -4, -15, -7, -4, 0], [11, -7, 6, 20, -7, 0], [-21, 12, 24, 0, 12, 0], [-1, 17, 12, 17, -1, -12], [-31, -3, -9, -3, -31, 9], [7, -32, 0, 7, -32, 18], [26, -5, 9, 19, -5, 0], [12, -1, -13, -1, 12, 13], [5, -14, 0, 5, 29, 4], [-10, 8, 16, 0, 8, 0], [5, -7, 0, 5, -20, -3], [-17, -8, -15, -8, -17, 15], [-5, -8, 0, -8, -5, 0], [-17, -5, -12, -2, -5, 0], [-7, -1, 0, -7, -23, 15], [42, -4, -12, -4, -4, 0], [4, -13, -21, 5, -13, 0], [-35, 7, -15, -29, 7, 0], [0, 9, 32, 14, 9, 0], [0, -27, 0, 0, -13, 27], [3, 0, -6, -6, 0, 0], [33, 0, 0, 0, 0, 0], [1, -20, -12, -20, 1, 12], [-4, -15, 0, -4, -7, 23], [-4, -19, -27, -19, -4, 27], [0, 25, 0, 0, 0, -25], [-31, 1, -12, -14, 1, 0], [12, -21, 0, 12, -32, -3], [-7, 8, 0, -7, -19, 6], [-4, -12, 1, -12, -4, -1], [2, 8, 0, 2, 30, -12], [18, -4, -13, -4, 18, 13], [-2, 5, 22, 5, -2, -22], [-37, -7, -3, 11, -7, 0], [-2, 7, 0, -2, -20, -3], [10, 3, 3, -3, 3, 0], [-21, 6, -9, -21, 6, 0], [3, -3, 0, 3, -27, -3], [19, -3, 18, -3, 19, -18], [6, 3, -9, 3, 6, 9], [17, 15, 6, 15, 17, -6], [2, -5, 0, 2, -25, 1], [-6, 21, 0, -6, 24, -9], [2, -15, -14, -15, 2, 14], [2, -2, 3, -2, 2, -3], [7, -29, 0, 7, -19, 15], [27, -6, 9, -6, 27, -9], [-17, 16, 6, 16, -17, -6], [-5, -8, -18, -8, -5, 18], [-9, -24, -30, -24, -9, 30], [14, 13, 18, -8, 13, 0], [-19, -10, -15, 5, -10, 0], [-29, 4, 3, -5, 4, 0], [-16, 11, 0, -16, -7, 21], [-2, -10, 0, -10, -2, 0], [19, 7, 0, -14, 7, 0], [-16, 14, 12, 14, -16, -12], [7, 23, 15, 23, 7, -15], [1, -3, 9, -3, 1, -9], [13, -19, 0, 13, -41, -7], [14, 2, -6, 2, 14, 6], [-2, 5, 0, -2, 31, -1], [1, -8, 3, -8, 1, -3], [-9, 30, 0, -9, 34, -12], [-38, -1, -12, -1, -38, 12], [30, -12, -19, 5, -12, 0], [-31, 10, 5, 10, -31, -5], [-7, 24, 0, -7, 38, -10], [-38, 15, -6, -36, 15, 0], [12, -12, 0, 12, -10, -12], [-24, 0, 12, 12, 0, 0], [0, 19, 3, 19, 0, -3], [2, -16, 0, 2, -16, 12], [13, -12, -9, -12, 13, 9], [8, 19, 0, 8, -7, -35], [-9, 8, 0, -9, 9, 10], [-4, 5, 0, -4, 5, 3], [0, 9, 0, 0, -12, -9], [-4, 29, 45, 29, -4, -45], [-6, 12, 0, -6, 8, 0], [-4, 14, 0, -4, 30, -6], [38, 2, -3, 2, 38, 3], [-36, -8, -18, -8, -36, 18], [-32, 10, -3, -23, 10, 0], [16, -4, -18, -10, -4, 0], [12, 21, 18, 21, 12, -18], [-6, 15, 0, -6, -30, -3], [41, -1, 1, 3, -1, 0], [25, -8, 1, 17, -8, 0], [-15, 13, 24, 13, -15, -24], [-13, 3, -3, 3, -13, 3], [1, 7, -6, 7, 1, 6], [-15, 26, 0, -15, 21, 4], [-17, 25, 0, -17, 34, 9], [-20, -11, -24, -2, -11, 0], [-5, 17, 19, 17, -5, -19], [28, -18, -21, -18, 28, 21], [-33, 12, 0, -24, 12, 0], [12, -39, 0, 12, -17, 15], [4, 16, 6, 16, 4, -6], [-4, -7, 0, -7, -4, 0], [-17, -6, 3, -6, -17, -3], [-13, 23, 23, -23, 23, 0], [27, 20, 23, 20, 27, -23], [9, -21, 0, 9, -25, 3], [-27, 15, 9, -21, 15, 0], [-6, -12, -5, 19, -12, 0], [-9, 16, 12, 16, -9, -12], [-19, 25, 18, -32, 25, 0], [13, -4, 7, -4, 13, -7], [-7, -11, -9, -11, -7, 9], [15, -2, 12, 16, -2, 0], [4, 4, 0, 4, 4, 0], [6, -6, 0, 6, -10, -6], [65, -7, 3, 17, -7, 0], [-12, -13, -25, -13, -12, 25], [2, 5, 0, 2, -39, -9], [30, -15, -12, -15, 30, 12], [-36, 15, 33, 3, 15, 0], [-1, 23, 0, -1, -17, -21], [5, 14, 6, -22, 14, 0], [-2, 5, 15, 5, 5, 0], [-5, 4, 0, -5, -42, 6], [-7, 8, 0, 8, -7, 0], [-19, 5, 10, 0, 5, 0], [47, -13, -3, 23, -13, 0], [-32, -16, -6, -16, -32, 6], [-2, 1, 0, -2, 40, 3], [-21, -30, -30, -30, -21, 30], [-7, 17, 21, 17, -7, -21], [-30, -9, 0, -9, -30, 0], [-29, -13, -18, -13, -29, 18], [-8, 7, -3, -17, 7, 0], [-10, -26, -25, -26, -10, 25], [-17, 43, 0, -17, 13, -9], [13, -28, 0, 13, 22, 2], [6, -13, -12, 14, -13, 0], [16, -11, -33, -11, -11, 0], [9, -9, -24, -6, -9, 0], [4, 16, 0, 4, -2, -24], [-33, -3, 9, 15, -3, 0], [-1, -15, 0, -1, 17, 17], [-10, 31, 36, 31, -10, -36], [-28, 17, 9, 17, -28, -9], [3, -18, 0, 3, 16, 12], [22, 10, 36, 10, 22, -36], [-48, -9, -21, -9, -48, 21], [-23, 10, 6, 10, -23, -6], [-27, 4, 0, -8, 4, 0], [-6, -3, 0, -3, -6, 0], [3, -36, 0, 3, -8, 30]]
