
# q-expansion of newform 1764.3.bk.f, downloaded from the LMFDB on 02 October 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, 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 = 3
poly_data = [324, -288, -50, -200, 239, -2, -13, -2, 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, 0, 0], 1], [[369692, 756, 1164, 1069, -834, -705, 184, 51], 54766], [[2726532, 230660, -644119, -2214086, 185843, 142618, 8183, -10084], 492894], [[5841234, -1400417, -1168671, -4017174, 371130, 258762, 14847, -18952], 410745], [[13632768, 1504798, 341858, -11140841, 687494, 691081, 56486, -49527], 821490], [[-51144534, 12178142, 10232621, 35173474, -3155995, -2265662, -129997, 164132], 2464470], [[-59937804, -6513434, -1510769, 48961283, -3093167, -3016903, -243803, 218011], 2464470], [[18545040, 1530046, -4386518, -15051769, 1290754, 975269, 53938, -68687], 492894]]

hecke_ring_character_values = [[883, [1, 0, 0, 0, 0, 0, 0, 0]], [785, [-1, 0, 0, 0, 0, 0, 0, 0]], [1081, [-1, 0, -1, 0, 0, 0, 0, 0]]]
aps_data = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -1, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, -1, 0], [14, -1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3, 0, 4, 0], [2, -3, 2, 0, 0, 0, 0, -3], [0, 0, 0, 3, 0, 8, 0, 0], [0, 0, 0, -1, -1, -1, -1, 0], [0, 0, 5, 0, 0, 0, 0, -1], [40, -3, 40, 0, 0, 0, 0, -3], [0, 0, 0, -2, -2, 6, 6, 0], [-10, 3, 0, 0, 0, 0, 0, 0], [0, 0, 0, 9, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 3, 0], [0, 0, 0, 0, 16, 0, -7, 0], [-2, 7, -2, 0, 0, 0, 0, 7], [0, 0, 36, 0, 0, 0, 0, -4], [0, 0, 0, -13, -13, 4, 4, 0], [0, 0, 72, 0, 0, 0, 0, 10], [35, -1, 35, 0, 0, 0, 0, -1], [0, 0, 0, -24, -24, -13, -13, 0], [0, 0, 0, -4, 0, 18, 0, 0], [69, 16, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 30, 0, -10, 0], [-58, 0, -58, 0, 0, 0, 0, 0], [0, 0, 0, -38, 0, -3, 0, 0], [0, 0, 48, 0, 0, 0, 0, -22], [0, 0, 0, -24, -24, -10, -10, 0], [-17, 25, 0, 0, 0, 0, 0, 0], [0, 0, 0, 8, 0, -25, 0, 0], [0, 0, 0, 0, -12, 0, -32, 0], [66, 10, 0, 0, 0, 0, 0, 0], [0, 0, 0, -40, 0, 0, 0, 0], [0, 0, 27, 0, 0, 0, 0, 23], [0, 0, 16, 0, 0, 0, 0, -6], [196, 9, 196, 0, 0, 0, 0, 9], [0, 0, 0, -60, -60, -20, -20, 0], [0, 0, 0, 4, 0, -22, 0, 0], [0, 0, 0, 0, -16, 0, -36, 0], [-10, -34, 0, 0, 0, 0, 0, 0], [0, 0, 0, 6, 0, 36, 0, 0], [0, 0, 83, 0, 0, 0, 0, 30], [0, 0, 0, -22, -22, 34, 34, 0], [0, 0, 142, 0, 0, 0, 0, 18], [-52, -3, 0, 0, 0, 0, 0, 0], [271, 3, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 56, 0, -3, 0], [198, -4, 198, 0, 0, 0, 0, -4], [0, 0, 0, -13, 0, 32, 0, 0], [0, 0, 0, -49, -49, -72, -72, 0], [0, 0, 7, 0, 0, 0, 0, -12], [0, 0, 0, 24, 24, 39, 39, 0], [0, 0, 0, -74, 0, -18, 0, 0], [0, 0, 0, 0, 61, 0, 42, 0], [0, 0, 0, 0, -31, 0, -61, 0], [-185, 25, -185, 0, 0, 0, 0, 25], [0, 0, -316, 0, 0, 0, 0, -6], [0, 0, 0, -48, -48, 4, 4, 0], [0, 0, 234, 0, 0, 0, 0, 13], [0, 0, 0, -11, -11, -87, -87, 0], [0, -17, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 40, 0, -10, 0], [-87, -10, -87, 0, 0, 0, 0, -10], [0, 0, 0, -51, 0, -15, 0, 0], [-440, 6, -440, 0, 0, 0, 0, 6], [-167, 10, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -24, 0, 12, 0], [24, 16, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -130, 0, 0, 0], [0, 0, 0, 6, 0, -92, 0, 0], [0, 0, -113, 0, 0, 0, 0, -15], [234, 58, 234, 0, 0, 0, 0, 58], [-78, -58, 0, 0, 0, 0, 0, 0], [0, 0, 0, -30, 0, -110, 0, 0], [0, 0, 0, 0, -108, 0, -26, 0], [388, -20, 388, 0, 0, 0, 0, -20], [0, 0, 0, 62, 0, 84, 0, 0], [0, 0, -47, 0, 0, 0, 0, -102], [0, 0, 0, -44, -44, 36, 36, 0], [130, 61, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 44, 0, -66, 0], [-260, 18, 0, 0, 0, 0, 0, 0], [-329, 37, -329, 0, 0, 0, 0, 37], [0, 0, 0, 124, 0, 53, 0, 0], [0, 0, 0, -41, -41, -106, -106, 0], [-255, 28, -255, 0, 0, 0, 0, 28], [0, 0, 0, -2, -2, -110, -110, 0], [-630, 32, 0, 0, 0, 0, 0, 0], [0, 0, 0, 78, 0, -46, 0, 0], [0, 0, 0, 0, -5, 0, 70, 0], [0, 0, 35, 0, 0, 0, 0, 63], [0, 0, 0, 80, 80, 45, 45, 0], [-342, -32, -342, 0, 0, 0, 0, -32], [0, 0, 0, 57, 57, -78, -78, 0], [0, 0, 0, -119, 0, 63, 0, 0], [0, 0, 0, 0, -143, 0, 24, 0], [-268, -75, -268, 0, 0, 0, 0, -75], [-112, -67, -112, 0, 0, 0, 0, -67], [142, 7, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -47, 0, 79, 0], [0, 0, 0, 0, -94, 0, -35, 0], [0, 0, 0, 45, 0, -120, 0, 0], [0, 0, -128, 0, 0, 0, 0, -83], [0, 0, -525, 0, 0, 0, 0, -32], [0, 0, 0, 72, 72, 11, 11, 0], [0, 0, 0, 65, 0, 90, 0, 0], [0, 0, 0, 0, 30, 0, 120, 0], [163, -12, 0, 0, 0, 0, 0, 0], [-35, 67, -35, 0, 0, 0, 0, 67], [0, 0, -230, 0, 0, 0, 0, 25], [0, 0, 0, -101, -101, -110, -110, 0], [0, 0, -120, 0, 0, 0, 0, 91], [-823, 33, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -91, 0, 62, 0], [-152, -150, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -71, 0, -72, 0], [0, 0, 0, 131, 0, 27, 0, 0], [0, 0, 0, -18, -18, -56, -56, 0], [0, 0, -696, 0, 0, 0, 0, 25], [185, 78, 0, 0, 0, 0, 0, 0], [0, 0, 0, -93, 0, 87, 0, 0], [0, 0, 0, 0, 8, 0, 69, 0], [-274, -120, -274, 0, 0, 0, 0, -120], [0, 0, 0, -221, -221, -43, -43, 0], [-362, -138, -362, 0, 0, 0, 0, -138], [0, 0, 0, -106, 0, -66, 0, 0], [321, -89, 0, 0, 0, 0, 0, 0], [460, -77, 460, 0, 0, 0, 0, -77], [0, 0, 574, 0, 0, 0, 0, 100], [0, 0, 0, 230, 230, 120, 120, 0], [515, 29, 515, 0, 0, 0, 0, 29], [-266, -119, 0, 0, 0, 0, 0, 0], [0, 0, 0, -141, 0, -26, 0, 0], [-759, 70, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 20, 0, 80, 0], [0, 0, 56, 0, 0, 0, 0, -1], [0, 0, 0, 43, 43, 33, 33, 0], [0, 0, 0, 0, 4, 0, -56, 0], [528, 82, 0, 0, 0, 0, 0, 0], [0, 0, 0, -215, 0, 5, 0, 0], [0, 0, 1026, 0, 0, 0, 0, -46], [0, 0, 0, -66, -66, -15, -15, 0], [0, 0, 60, 0, 0, 0, 0, -149], [0, 0, 0, 153, 153, 50, 50, 0], [1252, -30, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -7, 0, 18, 0], [-670, 75, -670, 0, 0, 0, 0, 75], [0, 0, 0, -24, 0, 190, 0, 0], [-228, 184, -228, 0, 0, 0, 0, 184], [0, 0, 0, -102, -102, -144, -144, 0], [-694, 36, 0, 0, 0, 0, 0, 0], [0, 0, 0, 121, 0, 72, 0, 0], [0, 0, -1028, 0, 0, 0, 0, -95], [0, 0, 0, 61, 61, -84, -84, 0], [474, -50, 474, 0, 0, 0, 0, -50], [0, 0, 0, 57, 0, 24, 0, 0], [-365, 42, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -137, 0, -25, 0], [0, 0, 0, 224, 0, 148, 0, 0], [0, 0, 0, 5, 5, 160, 160, 0], [-445, 117, 0, 0, 0, 0, 0, 0], [0, 0, 0, 20, 0, 105, 0, 0], [0, 0, 0, 0, -135, 0, -60, 0], [0, 0, 0, 0, 362, 0, -54, 0], [0, 0, 701, 0, 0, 0, 0, 135], [0, 0, 1120, 0, 0, 0, 0, 12], [239, 30, 0, 0, 0, 0, 0, 0], [0, 0, 0, 229, 0, 75, 0, 0], [0, 0, 0, 0, 222, 0, 289, 0], [108, -143, 0, 0, 0, 0, 0, 0], [0, 0, 0, -289, 0, -234, 0, 0], [0, 0, 91, 0, 0, 0, 0, -134], [0, 0, 269, 0, 0, 0, 0, 77], [0, 0, 0, -72, -72, 16, 16, 0], [610, 49, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 21, 0, 221, 0], [-1094, -6, 0, 0, 0, 0, 0, 0], [-250, -9, -250, 0, 0, 0, 0, -9], [215, -163, 215, 0, 0, 0, 0, -163], [0, 0, 0, -276, -276, 149, 149, 0], [-300, -28, 0, 0, 0, 0, 0, 0], [0, 0, 0, -174, 0, -88, 0, 0], [0, 0, 0, 0, 278, 0, -62, 0], [0, 0, 0, 0, 305, 0, 135, 0], [0, 0, 1024, 0, 0, 0, 0, -59], [0, 0, 820, 0, 0, 0, 0, -102], [1511, 50, 1511, 0, 0, 0, 0, 50], [0, 0, 0, 0, 55, 0, 30, 0], [-471, 74, -471, 0, 0, 0, 0, 74], [0, 0, 0, -104, -104, -213, -213, 0], [1218, -41, 1218, 0, 0, 0, 0, -41], [0, 0, 0, -178, 0, -86, 0, 0], [0, 0, 0, 0, -28, 0, 147, 0], [0, 0, 0, 0, 188, 0, -242, 0], [0, 0, 290, 0, 0, 0, 0, 84], [-558, 13, -558, 0, 0, 0, 0, 13], [0, 0, 0, 107, 107, -108, -108, 0], [0, 0, 0, 221, 0, 240, 0, 0], [0, 0, 0, 0, -3, 0, -225, 0], [2060, -46, 0, 0, 0, 0, 0, 0], [320, -240, 320, 0, 0, 0, 0, -240], [0, 0, 1100, 0, 0, 0, 0, 20], [0, 0, 0, -330, -330, -120, -120, 0], [0, 0, 0, 0, 229, 0, 435, 0], [368, -258, 368, 0, 0, 0, 0, -258], [0, 0, 0, -268, 0, 27, 0, 0], [0, 0, 0, -5, -5, 180, 180, 0], [0, 0, 742, 0, 0, 0, 0, -84], [196, -114, 196, 0, 0, 0, 0, -114], [0, 0, 0, 111, 111, 151, 151, 0], [-419, -161, 0, 0, 0, 0, 0, 0], [0, 0, 0, 16, 0, 17, 0, 0], [0, 0, 0, 0, -279, 0, -234, 0], [-616, -210, -616, 0, 0, 0, 0, -210], [0, 0, 1059, 0, 0, 0, 0, 11], [0, 0, 0, 0, -335, 0, -230, 0], [0, 0, 0, -154, 0, -88, 0, 0], [0, 0, 0, 28, 28, -272, -272, 0], [1680, 34, 1680, 0, 0, 0, 0, 34], [-1122, -134, 0, 0, 0, 0, 0, 0], [0, 0, 0, 155, 0, 330, 0, 0], [225, 205, 225, 0, 0, 0, 0, 205], [0, 0, 0, -374, -374, -105, -105, 0], [968, -18, 0, 0, 0, 0, 0, 0], [0, 0, 0, 206, 0, -128, 0, 0], [0, 0, 0, 0, -2, 0, -320, 0], [313, 85, 313, 0, 0, 0, 0, 85], [0, 0, 0, -282, 0, -204, 0, 0], [0, 0, 1162, 0, 0, 0, 0, 121], [0, 0, 450, 0, 0, 0, 0, 70], [975, -241, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 60, 0, 330, 0], [1138, 210, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -355, 0, 60, 0], [459, 50, 459, 0, 0, 0, 0, 50], [0, 0, 0, 301, 0, -33, 0, 0], [0, 0, 0, 38, 38, 276, 276, 0], [0, 0, 0, 197, 197, 124, 124, 0], [0, 0, 0, 0, -16, 0, 128, 0], [290, 186, 290, 0, 0, 0, 0, 186], [0, 0, 91, 0, 0, 0, 0, 21], [-772, 212, -772, 0, 0, 0, 0, 212], [0, 0, 0, -175, -175, 110, 110, 0], [0, 0, 0, -180, 0, 150, 0, 0], [-1135, -43, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -70, 0, 400, 0], [0, 0, 188, 0, 0, 0, 0, -108], [0, 0, 0, 294, 294, 138, 138, 0], [-1140, -178, 0, 0, 0, 0, 0, 0], [0, 0, 0, 95, 0, 330, 0, 0], [0, 0, 0, 0, 228, 0, 228, 0], [1542, -68, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 85, 0, -365, 0], [0, 0, 0, 212, 0, 155, 0, 0], [0, 0, -496, 0, 0, 0, 0, -135], [0, 0, -490, 0, 0, 0, 0, 218], [0, 0, 0, 335, 335, 475, 475, 0], [-637, 18, -637, 0, 0, 0, 0, 18], [0, 0, -1284, 0, 0, 0, 0, 26], [0, 0, 0, -76, -76, 353, 353, 0], [0, 0, -624, 0, 0, 0, 0, -20], [-1638, 10, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -213, 0, -18, 0], [-2040, -46, -2040, 0, 0, 0, 0, -46], [0, 0, 0, 615, 615, -15, -15, 0], [0, 0, 0, 199, 199, -98, -98, 0], [-1122, 212, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 135, 0, 195, 0], [868, 298, 868, 0, 0, 0, 0, 298], [0, 0, -2230, 0, 0, 0, 0, 90], [0, 0, 1835, 0, 0, 0, 0, -172], [-563, 117, -563, 0, 0, 0, 0, 117], [-261, -44, 0, 0, 0, 0, 0, 0], [-1046, 346, -1046, 0, 0, 0, 0, 346], [0, 0, 0, 324, 0, -37, 0, 0], [0, 0, -1310, 0, 0, 0, 0, -11], [48, -182, 48, 0, 0, 0, 0, -182], [0, 0, 0, -372, 0, 36, 0, 0], [0, 0, 0, 0, 171, 0, 432, 0], [0, 0, 715, 0, 0, 0, 0, -89], [0, 0, 0, 593, 593, -72, -72, 0], [2038, 48, 0, 0, 0, 0, 0, 0], [1144, 52, 1144, 0, 0, 0, 0, 52], [0, 0, 0, 65, 0, 230, 0, 0], [0, 0, -413, 0, 0, 0, 0, 106], [0, 0, 0, -95, -95, -125, -125, 0], [0, 0, -2141, 0, 0, 0, 0, -75], [0, 0, 0, 420, 420, 180, 180, 0], [0, 0, 0, 0, -170, 0, -330, 0], [0, 0, 0, 0, -134, 0, 297, 0], [0, 0, 0, 554, 0, 48, 0, 0], [0, 0, 0, 162, 162, 130, 130, 0], [-106, -261, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -249, 0, 291, 0], [2276, -150, 2276, 0, 0, 0, 0, -150], [0, 0, 0, -4, -4, 360, 360, 0], [0, 0, 0, -340, 0, -600, 0, 0], [638, -325, 0, 0, 0, 0, 0, 0], [-2268, 62, -2268, 0, 0, 0, 0, 62], [0, 0, 0, 241, 0, 45, 0, 0], [0, 0, 3267, 0, 0, 0, 0, -7]]
