
# q-expansion of newform 1280.3.e.f, downloaded from the LMFDB on 10 May 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 = 1280
weight = 3
poly_data = [1, 0, 14, 0, 9, 0, 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, 2, 0, 0, 0, 0], 1], [[-7, 0, 10, 0, 2, 0], 5], [[0, 38, 0, 20, 0, 2], 5], [[23, 73, 20, 60, 2, 7], 5], [[21, -73, 30, -60, 4, -7], 5]]

hecke_ring_character_values = [[511, [-1, 0, 0, 0, 0, 0]], [261, [-1, 0, 0, 0, 0, 0]], [257, [-1, 0, 0, 0, 0, 0]]]
aps_data = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [-2, 0, -1, 0, 0, 1], [-2, 0, 0, 0, -1, -1], [-2, 0, -2, 0, 2, 2], [-1, 0, -3, 0, -1, -1], [-2, 0, -2, -6, -2, 2], [2, 0, -6, 0, -2, -2], [12, 0, 2, 0, -3, -3], [0, 8, 0, -1, 0, 0], [4, 0, 4, 4, 4, -4], [33, 0, -5, 0, -3, -3], [13, 0, 5, 0, 1, 1], [-6, -5, -6, -6, -6, 6], [42, 0, -8, 0, 1, 1], [-5, 0, 17, 0, -5, -5], [-62, 0, -6, 0, -2, -2], [-7, -8, -7, 8, -7, 7], [2, -11, 2, -30, 2, -2], [8, 8, 8, -12, 8, -8], [-4, 4, -4, -4, -4, 4], [-4, -16, -4, -44, -4, 4], [-14, -11, -14, 18, -14, 14], [-10, 0, 8, 0, 16, 16], [-6, -8, -6, -18, -6, 6], [-16, -24, -16, 25, -16, 16], [-20, 0, 2, 0, -3, -3], [20, -1, 20, 20, 20, -20], [-7, 0, -7, -16, -7, 7], [-20, -8, -20, 20, -20, 20], [-20, 0, -26, 0, 3, 3], [34, 0, 42, 0, -2, -2], [6, -4, 6, 10, 6, -6], [-98, 0, 30, 0, 2, 2], [-17, -40, -17, -8, -17, 17], [-20, -8, -20, -32, -20, 20], [125, 0, 15, 0, 9, 9], [20, 41, 20, -60, 20, -20], [16, 0, -34, 0, 1, 1], [81, 0, 43, 0, -3, -3], [62, 0, -50, 0, 2, 2], [16, 88, 16, 41, 16, -16], [-8, -64, -8, -8, -8, 8], [14, 24, 14, -54, 14, -14], [-109, 0, 9, 0, -5, -5], [-40, -56, -40, 68, -40, 40], [-134, 0, -30, 0, -26, -26], [72, 0, -54, 0, 31, 31], [-4, -39, -4, 44, -4, 4], [0, -24, 0, -39, 0, 0], [36, 52, 36, 20, 36, -36], [-4, -16, -4, 4, -4, 4], [139, 0, -29, 0, 7, 7], [-130, 0, -18, 0, 2, 2], [16, 80, 16, 96, 16, -16], [18, 0, -20, 0, 3, 3], [-7, -72, -7, -88, -7, 7], [20, -16, 20, 44, 20, -20], [-203, 0, -41, 0, 33, 33], [213, 0, 13, 0, 33, 33], [12, -1, 12, 188, 12, -12], [-51, 0, 79, 0, 1, 1], [-2, -3, -2, 126, -2, 2], [12, -72, 12, 80, 12, -12], [2, 36, 2, 142, 2, -2], [47, 0, 29, 0, -9, -9], [-94, 0, -86, 0, 30, 30], [0, 104, 0, 32, 0, 0], [-14, 27, -14, -62, -14, 14], [48, -8, 48, 31, 48, -48], [52, -32, 52, -4, 52, -52], [4, -88, 4, -112, 4, -4], [-108, 0, -34, 0, -21, -21], [213, 0, 23, 0, 49, 49], [190, 0, 46, 0, -30, -30], [-116, 0, -122, 0, -45, -45], [47, 56, 47, -136, 47, -47], [115, 0, 9, 0, 75, 75], [266, 0, -24, 0, 16, 16], [-179, 0, -91, 0, 17, 17], [-482, 0, -2, 0, 34, 34], [15, -56, 15, 184, 15, -15], [20, -16, 20, -228, 20, -20], [10, -32, 10, -194, 10, -10], [-36, -136, -36, -160, -36, 36], [8, -9, 8, -184, 8, -8], [-293, 0, -77, 0, -9, -9], [106, 108, 106, -74, 106, -106], [16, 24, 16, 239, 16, -16], [306, 0, 112, 0, 25, 25], [56, 81, 56, -168, 56, -56], [16, 128, 16, 160, 16, -16], [-62, 0, 124, 0, -45, -45], [-470, 0, 34, 0, -10, -10], [-42, 0, 86, 0, -86, -86], [252, 0, 18, 0, -35, -35], [0, 136, 0, 47, 0, 0], [350, 0, -80, 0, -48, -48], [-48, -137, -48, 96, -48, 48], [80, 40, 80, 95, 80, -80], [-16, 145, -16, -32, -16, 16], [-95, 0, 91, 0, -3, -3], [4, -55, 4, 20, 4, -4], [-131, 0, 117, 0, 65, 65], [198, 0, 70, 0, 58, 58], [100, 112, 100, -148, 100, -100], [34, 123, 34, 306, 34, -34], [12, -72, 12, 292, 12, -12], [-80, 56, -80, -172, -80, 80], [229, 0, -67, 0, 33, 33], [-54, 0, 184, 0, 17, 17], [-5, 0, -191, 0, -45, -45], [0, 52, 0, 88, 0, 0], [74, 0, -190, 0, -10, -10], [-20, -168, -20, -16, -20, 20], [347, 0, -13, 0, 39, 39], [-58, -131, -58, -10, -58, 58], [366, 0, 208, 0, 63, 63], [19, 0, 105, 0, -69, -69], [-266, 0, 22, 0, 42, 42], [31, -176, 31, 128, 31, -31], [50, 248, 50, -42, 50, -50], [591, 0, 45, 0, -81, -81], [-106, -205, -106, 6, -106, 106], [-142, 0, -22, 0, 78, 78], [-55, 256, -55, 96, -55, 55], [16, -104, 16, -119, 16, -16], [76, -16, 76, 164, 76, -76], [-214, 0, -12, 0, 75, 75], [-999, 0, -77, 0, 61, 61], [-170, 0, 38, 0, 42, 42], [342, 0, -216, 0, 7, 7], [-112, -80, -112, 232, -112, 112], [-807, 0, -109, 0, -83, -83], [438, 0, -40, 0, 112, 112], [2, 0, -16, 0, -48, -48], [79, 0, 13, 0, 47, 47], [-118, -155, -118, 266, -118, 118], [675, 0, -183, 0, 3, 3], [-418, 0, -144, 0, 80, 80], [454, 0, -10, 0, -134, -134], [-177, -224, -177, 176, -177, 177], [-184, 0, -58, 0, 41, 41], [126, 67, 126, 142, 126, -126], [-87, -104, -87, 376, -87, 87], [148, 104, 148, -176, 148, -148], [811, 0, 129, 0, 75, 75], [-42, -348, -42, -246, -42, 42], [-494, 0, 138, 0, -50, -50], [-114, 0, -268, 0, 133, 133], [-203, 0, -249, 0, -119, -119], [547, 0, -37, 0, 55, 55], [-56, -239, -56, -312, -56, 56], [502, 0, 40, 0, -41, -41], [-68, -1, -68, -564, -68, 68], [-20, 272, -20, 4, -20, 20], [-16, -72, -16, 116, -16, 16], [75, 0, 323, 0, 7, 7], [-28, -124, -28, -156, -28, 28], [-48, 72, -48, 255, -48, 48], [-14, 229, -14, 322, -14, 14], [-42, -12, -42, 74, -42, 42], [88, 0, 22, 0, 25, 25], [-246, 0, -94, 0, 214, 214], [-14, -80, -14, 22, -14, 14], [-846, 0, 44, 0, 3, 3], [192, 416, 192, -80, 192, -192], [-905, 0, 69, 0, -73, -73], [-286, 0, -208, 0, 80, 80], [327, 0, 5, 0, -113, -113], [238, 0, 126, 0, 50, 50], [-48, -40, -48, -193, -48, 48], [-68, 168, -68, 248, -68, 68], [-48, 180, -48, 312, -48, 48], [16, 80, 16, -264, 16, -16], [-210, 0, 112, 0, 16, 16], [1006, 0, 222, 0, -14, -14], [-64, 8, -64, 73, -64, 64], [-76, 0, -70, 0, 229, 229], [25, -144, 25, -368, 25, -25], [0, 0, 18, 0, -25, -25], [1642, 0, 130, 0, 54, 54], [-893, 0, 25, 0, 91, 91], [-80, 36, -80, -184, -80, 80], [-66, 0, -28, 0, 213, 213], [112, 424, 112, 57, 112, -112], [-347, 0, -89, 0, 209, 209], [86, -179, 86, -74, 86, -86], [-35, 0, -203, 0, 129, 129], [0, 32, 0, -352, 0, 0], [180, 160, 180, -308, 180, -180], [136, 151, 136, -216, 136, -136], [-1246, 0, -38, 0, -2, -2], [121, -16, 121, -208, 121, -121], [186, 309, 186, -566, 186, -186], [-56, 20, -56, 80, -56, 56], [291, 0, 91, 0, -121, -121], [-5, 0, 337, 0, -133, -133], [-128, -400, -128, -464, -128, 128], [312, 0, -138, 0, -151, -151], [64, 56, 64, -817, 64, -64], [-216, -432, -216, -48, -216, 216], [27, 0, -239, 0, 171, 171], [218, 0, -56, 0, -160, -160], [42, 0, 98, 0, -10, -10], [-831, 0, -21, 0, -11, -11], [76, 256, 76, -452, 76, -76], [-126, -27, -126, -622, -126, 126], [-498, 0, 112, 0, 80, 80], [-390, 0, -142, 0, 6, 6], [82, -464, 82, -170, 82, -82], [79, 120, 79, -40, 79, -79], [-118, 0, -172, 0, 59, 59], [202, 443, 202, 106, 202, -202], [48, -280, 48, -372, 48, -48], [-371, 0, 325, 0, -79, -79], [1480, 0, -214, 0, 95, 95], [-822, 0, -88, 0, -144, -144], [-848, 0, -290, 0, -31, -31], [1087, 0, 237, 0, 199, 199], [-97, -128, -97, -32, -97, 97], [316, 248, 316, 96, 316, -316], [-470, 0, -152, 0, 208, 208], [-864, 0, -174, 0, 7, 7], [-54, -683, -54, -390, -54, 54], [207, -32, 207, 528, 207, -207], [172, 460, 172, 380, 172, -172], [140, 128, 140, 556, 140, -140], [280, 0, 86, 0, -55, -55], [-998, 0, -334, 0, -250, -250], [251, 0, -31, 0, 163, 163], [-746, 0, -234, 0, 170, 170], [-8, 256, -8, 632, -8, 8], [341, 0, 173, 0, 33, 33], [-22, 155, -22, -86, -22, 22], [1268, 0, 62, 0, -245, -245], [731, 0, 83, 0, -153, -153], [-1049, 0, -187, 0, -49, -49], [698, 0, 322, 0, -186, -186], [-100, 104, -100, 456, -100, 100], [70, -323, 70, 534, 70, -70], [70, 0, 134, 0, -102, -102], [-54, 0, -140, 0, -245, -245], [-64, -392, -64, -465, -64, 64], [16, 184, 16, -480, 16, -16], [20, -40, 20, -184, 20, -20], [140, 0, -314, 0, -109, -109], [334, 0, 14, 0, 114, 114], [-694, 0, -62, 0, 406, 406], [-146, 0, -204, 0, -235, -235], [-625, 0, -451, 0, -281, -281], [-838, 0, -280, 0, 96, 96], [2026, 0, 212, 0, 43, 43], [805, 0, 221, 0, 81, 81], [-1227, 0, 39, 0, 89, 89], [-1534, 0, -6, 0, -98, -98], [128, -56, 128, -663, 128, -128], [102, 227, 102, 678, 102, -102], [873, 0, -13, 0, -155, -155], [254, 324, 254, -590, 254, -254], [-1850, 0, 60, 0, 205, 205], [-40, -463, -40, -200, -40, 40], [176, -152, 176, 185, 176, -176], [825, 0, -557, 0, 205, 205], [-18, -8, -18, 1338, -18, 18], [-146, 0, -274, 0, -270, -270], [-64, -584, -64, -1025, -64, 64], [302, 0, 240, 0, -176, -176], [-8, -345, -8, -1080, -8, 8], [1545, 0, 179, 0, 149, 149], [320, 616, 320, -481, 320, -320], [336, 321, 336, 16, 336, -336], [328, 620, 328, 192, 328, -328], [116, -224, 116, 116, 116, -116], [-224, -264, -224, -448, -224, 224], [-402, 0, 176, 0, -241, -241], [-116, -577, -116, -836, -116, 116], [0, 248, 0, 1023, 0, 0], [-219, 0, 221, 0, 241, 241], [334, 0, 606, 0, 114, 114], [1794, 0, -64, 0, 57, 57], [-96, 392, -96, 220, -96, 96], [-80, 0, 30, 0, 257, 257], [-80, -344, -80, -247, -80, 80], [-66, -381, -66, 78, -66, 66], [432, 688, 432, 24, 432, -432], [-70, -320, -70, 894, -70, 70], [-621, 0, 153, 0, -205, -205], [192, 600, 192, 324, 192, -192], [-909, 0, 43, 0, 167, 167], [-55, 88, -55, 248, -55, 55], [70, 781, 70, 806, 70, -70], [-220, -116, -220, 660, -220, 220], [-2430, 0, 10, 0, -98, -98], [165, 0, -9, 0, -135, -135], [169, 152, 169, 696, 169, -169], [352, 128, 352, 208, 352, -352], [-759, 0, -221, 0, -323, -323], [170, 0, 242, 0, -42, -42], [-120, -223, -120, -72, -120, 120], [-74, -212, -74, -182, -74, 74], [1881, 0, -381, 0, 21, 21], [200, 464, 200, 176, 200, -200]]
