
# q-expansion of newform 1600.3.b.m, downloaded from the LMFDB on 30 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 = 1600
weight = 3
poly_data = [9, 0, -5, 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], 1], [[0, 32, 0, -4], 3], [[-15, -4, 6, 2], 3], [[-15, 4, 6, -2], 3]]

hecke_ring_character_values = [[1151, [-1, 0, 0, 0]], [901, [1, 0, 0, 0]], [577, [1, 0, 0, 0]]]
aps_data = [[0, 0, 0, 0], [0, 0, -1, 0], [0, 0, 0, 0], [0, 0, -2, 0], [0, 0, -2, -1], [4, 0, 0, 0], [-1, -1, 0, 0], [0, 0, 7, -2], [0, 0, -2, -4], [-24, -2, 0, 0], [0, 0, -8, 10], [6, 4, 0, 0], [33, -2, 0, 0], [0, 0, 3, 5], [0, 0, -2, -2], [26, -2, 0, 0], [0, 0, -3, -17], [-54, 2, 0, 0], [0, 0, 22, -29], [0, 0, -26, 30], [-43, -1, 0, 0], [0, 0, 16, -10], [0, 0, -12, 1], [55, 5, 0, 0], [46, 0, 0, 0], [-10, 4, 0, 0], [0, 0, -10, -26], [0, 0, 6, -35], [6, -4, 0, 0], [-39, 2, 0, 0], [0, 0, -20, -30], [0, 0, 11, 21], [-89, -12, 0, 0], [0, 0, -12, -7], [40, 14, 0, 0], [0, 0, 36, 6], [-26, 2, 0, 0], [0, 0, 24, -15], [0, 0, 36, -48], [0, 22, 0, 0], [0, 0, 37, -28], [130, -10, 0, 0], [0, 0, -10, 0], [-73, 7, 0, 0], [114, -6, 0, 0], [0, 0, 12, -56], [0, 0, 24, 63], [0, 0, 42, -14], [0, 0, 17, 31], [4, -16, 0, 0], [306, -4, 0, 0], [0, 0, -40, -24], [-371, -5, 0, 0], [0, 0, -25, 56], [-126, 8, 0, 0], [0, 0, -108, 62], [24, -6, 0, 0], [0, 0, -66, -68], [-48, -20, 0, 0], [-26, -4, 0, 0], [0, 0, 11, -18], [234, 14, 0, 0], [0, 0, -3, -14], [0, 0, -44, -14], [30, -20, 0, 0], [76, -6, 0, 0], [0, 0, -34, 3], [157, 26, 0, 0], [0, 0, -100, 71], [318, -22, 0, 0], [-102, 12, 0, 0], [0, 0, -2, 32], [0, 0, 18, 98], [430, -16, 0, 0], [0, 0, -65, 124], [0, 0, -56, 114], [-506, -20, 0, 0], [-628, -4, 0, 0], [-183, -17, 0, 0], [-543, -2, 0, 0], [0, 0, 103, -62], [-156, -36, 0, 0], [0, 0, 110, 56], [-553, -7, 0, 0], [0, 0, 20, -12], [0, 0, -69, 146], [93, -55, 0, 0], [555, -10, 0, 0], [-332, 14, 0, 0], [0, 0, 56, -84], [0, 0, 21, 107], [0, 0, 142, 88], [0, 0, -172, 146], [0, 0, -15, -121], [0, 0, -137, 161], [0, 0, -82, 134], [-46, -24, 0, 0], [537, -4, 0, 0], [0, 0, -126, 133], [-520, 10, 0, 0], [0, 0, -55, -82], [-780, 0, 0, 0], [0, 0, -171, 143], [133, 12, 0, 0], [0, 0, 113, -97], [-187, -42, 0, 0], [0, 0, -177, 126], [-319, 52, 0, 0], [0, 0, -210, 64], [243, -9, 0, 0], [0, 0, -206, 198], [442, -44, 0, 0], [250, 32, 0, 0], [0, 0, 61, 179], [0, 0, 154, -72], [122, 0, 0, 0], [0, 0, -87, 119], [0, 0, 106, 178], [-782, 2, 0, 0], [0, 0, 24, -133], [704, 16, 0, 0], [-282, 68, 0, 0], [272, -72, 0, 0], [0, 0, -176, -1], [0, 0, -143, -56], [-636, -6, 0, 0], [356, -8, 0, 0], [0, 0, -50, -84], [0, 0, 26, -98], [116, 60, 0, 0], [0, 0, -225, 57], [0, 0, 138, 144], [0, 0, 132, -148], [-632, -10, 0, 0], [-551, -54, 0, 0], [-463, -43, 0, 0], [32, -82, 0, 0], [0, 0, 181, -77], [774, 32, 0, 0], [-166, -44, 0, 0], [0, 0, 89, 183], [530, 12, 0, 0], [0, 0, 264, -148], [0, 0, -337, 198], [1340, -18, 0, 0], [0, 0, -98, -182], [-34, 36, 0, 0], [687, 8, 0, 0], [0, 0, -56, 173], [0, 0, -104, 192], [132, 62, 0, 0], [-82, 48, 0, 0], [0, 0, 89, -338], [0, 0, -108, -224], [0, 0, 235, -203], [0, 0, -74, 222], [0, 0, 168, -234], [-354, -32, 0, 0], [221, 95, 0, 0], [588, -96, 0, 0], [0, 0, 209, -133], [1075, -4, 0, 0], [0, 0, 258, -266], [0, 0, -276, 345], [-1029, 53, 0, 0], [0, 0, -184, 234], [0, 0, 286, -176], [-684, -42, 0, 0], [-143, -37, 0, 0], [-560, -14, 0, 0], [0, 0, 457, -398], [298, 106, 0, 0], [0, 0, -200, -18], [813, 1, 0, 0], [0, 0, 62, -350], [703, 59, 0, 0], [0, 0, 51, 68], [-514, -30, 0, 0], [0, 0, -184, -64], [-566, -54, 0, 0], [0, 0, 160, -228], [0, 0, 373, 84], [74, -72, 0, 0], [401, -69, 0, 0], [0, 0, -436, 384], [-4, -58, 0, 0], [1014, -74, 0, 0], [0, 0, -253, 80], [525, 110, 0, 0], [0, 0, -176, 224], [481, 20, 0, 0], [0, 0, -43, 156], [0, 0, 366, 81], [-346, 94, 0, 0], [0, 0, 15, 36], [-2, 152, 0, 0], [379, 4, 0, 0], [662, -64, 0, 0], [-779, -104, 0, 0], [0, 0, -82, -68], [-1206, 54, 0, 0], [0, 0, -410, 134], [-152, 78, 0, 0], [-581, -14, 0, 0], [0, 0, 333, -301], [22, -132, 0, 0], [0, 0, 4, 254], [0, 0, -303, 7], [1126, 12, 0, 0], [0, 0, 305, -245], [1246, -40, 0, 0], [282, 58, 0, 0], [0, 0, 28, -44], [0, 0, 166, -343], [0, 0, 324, -490], [-643, -132, 0, 0], [0, 0, -190, -316], [1801, 39, 0, 0], [0, 0, -208, 186], [702, -60, 0, 0], [-66, 118, 0, 0], [0, 0, 60, 280], [-523, 91, 0, 0], [0, 0, 116, -466], [0, 0, 1, 358], [-714, 98, 0, 0], [-751, -9, 0, 0], [0, 0, 236, -188], [0, 0, -280, 196], [0, 0, 27, -256], [-914, -50, 0, 0], [0, 0, 174, 277], [0, 0, -60, 270], [151, 91, 0, 0], [0, 0, 499, -223], [0, 0, -518, 416], [745, 73, 0, 0], [1424, 50, 0, 0], [0, 0, 277, 58], [0, 0, -408, 532], [0, 0, -289, 512], [0, 0, -115, -450], [0, 0, 64, -354], [-1708, -40, 0, 0], [925, -94, 0, 0], [0, 0, -108, 28], [0, 0, -300, 22], [0, 0, -149, 437], [0, 0, -181, 56], [0, 0, 304, 392], [2056, -42, 0, 0], [491, -48, 0, 0], [0, 0, 56, 322], [171, -137, 0, 0], [1032, 12, 0, 0], [0, 0, -484, 7], [-688, -20, 0, 0], [0, 0, 81, 308], [1862, 32, 0, 0], [-161, -78, 0, 0], [0, 0, 340, 350], [0, 0, -228, 285], [48, -150, 0, 0], [1676, -42, 0, 0], [919, 79, 0, 0], [0, 0, -481, 322], [-1994, 58, 0, 0], [-458, 32, 0, 0], [0, 0, 348, -229], [-1394, 128, 0, 0], [1660, -6, 0, 0], [0, 0, -82, 455], [-975, 19, 0, 0], [0, 0, -532, 220], [-882, 112, 0, 0], [0, 0, -678, 434], [0, 0, -626, 465], [-352, -2, 0, 0], [598, 152, 0, 0], [0, 0, -49, 210], [0, 0, -76, 56], [0, 0, -232, -378], [0, 0, -230, 694], [-188, 36, 0, 0], [0, 0, -299, 252], [0, 0, 42, -234], [2002, -80, 0, 0], [2080, 28, 0, 0], [0, 0, -530, 266], [-190, 128, 0, 0], [1242, -148, 0, 0], [0, 0, -111, -193], [-747, -119, 0, 0], [0, 0, -195, 434], [-1508, 66, 0, 0], [1886, -60, 0, 0], [0, 0, 230, -252], [-1032, -168, 0, 0], [0, 0, -395, 707], [0, 0, 246, 671], [-1061, -60, 0, 0], [-2838, 74, 0, 0], [0, 0, -38, 622]]
