
# q-expansion of newform 1200.3.l.f, downloaded from the LMFDB on 25 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
    R = PolynomialRing(QQ, "x")
    f = R(poly_data)
    K = NumberField(f, "a")
    betas = [K.gens()[0]**i for i in range(len(poly_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 = 1200
weight = 3
poly_data = [3, -1, 1]

# The basis for the coefficient ring is just the power basis
# in the root of the defining polynomial above.
hecke_ring_character_values = [[751, [1, 0]], [901, [1, 0]], [401, [-1, 0]], [577, [1, 0]]]
aps_data = [[0, 0], [-3, 1], [0, 0], [0, 0], [5, -10], [10, 0], [1, -2], [-7, 0], [-6, 12], [-10, 20], [-42, 0], [-40, 0], [5, -10], [50, 0], [14, -28], [-14, 28], [20, -40], [-8, 0], [-45, 0], [10, -20], [-35, 0], [-12, 0], [-21, 42], [45, -90], [-70, 0], [0, 0], [70, 0], [-21, 42], [-88, 0], [31, -62], [-190, 0], [-60, 120], [21, -42], [-77, 0], [50, -100], [-172, 0], [-250, 0], [-35, 0], [54, -108], [-84, 168], [35, -70], [182, 0], [70, -140], [-25, 0], [66, -132], [68, 0], [-77, 0], [-140, 0], [-56, 112], [372, 0], [36, -72], [-70, 140], [-413, 0], [75, -150], [-84, 168], [-86, 172], [-140, 280], [-22, 0], [-210, 0], [60, -120], [-345, 0], [96, -192], [-325, 0], [-120, 240], [-490, 0], [-64, 128], [243, 0], [385, 0], [89, -178], [532, 0], [-84, 168], [120, -240], [180, 0], [-110, 0], [533, 0], [24, -48], [-30, 60], [-20, 0], [225, -450], [77, 0], [-35, 70], [412, 0], [-60, 120], [-455, 0], [-22, 0], [159, -318], [25, -50], [-275, 0], [-180, 360], [240, 0], [4, -8], [-90, 180], [-410, 0], [-80, 160], [-322, 0], [124, -248], [130, -260], [-85, 170], [-1015, 0], [912, 0], [-55, 0], [306, -612], [-36, 72], [-15, 30], [-242, 0], [665, 0], [189, -378], [-259, 518], [100, -200], [-343, 0], [1100, 0], [-290, 0], [-24, 48], [58, 0], [-862, 0], [180, -360], [1050, 0], [-76, 152], [-364, 728], [245, -490], [-98, 0], [-210, 0], [-24, 48], [-51, 102], [713, 0], [350, -700], [-248, 0], [-60, 120], [10, 0], [770, 0], [-802, 0], [-406, 812], [-322, 0], [400, 0], [-105, 210], [-193, 0], [126, -252], [-910, 0], [-334, 668], [380, -760], [858, 0], [-210, 420], [1060, 0], [-151, 302], [-1038, 0], [280, -560], [630, 0], [391, -782], [-307, 0], [-146, 292], [840, 0], [-140, 280], [-995, 0], [144, -288], [1050, 0], [-220, 440], [-1342, 0], [140, -280], [-165, 0], [-70, 140], [84, -168], [-59, 118], [280, 0], [-315, 630], [331, -662], [504, -1008], [-452, 0], [-420, 0], [-1063, 0], [-214, 428], [-135, 270], [112, 0], [540, -1080], [-105, 0], [1358, 0], [75, -150], [1023, 0], [420, -840], [640, 0], [-518, 0], [40, 0], [-455, 910], [400, 0], [-199, 398], [534, -1068], [580, -1160], [1320, 0], [-1465, 0], [2147, 0], [350, -700], [1555, 0], [-31, 62], [303, 0], [10, -20], [219, -438], [-484, 968], [-143, 0], [-1290, 0], [21, -42], [-476, 952], [-210, 420], [1908, 0], [1260, 0], [-443, 0], [-180, 360], [-174, 348], [2038, 0], [-196, 392], [-480, 960], [898, 0], [1430, 0], [-100, 200], [1770, 0], [-721, 1442], [-210, 420], [1637, 0], [2510, 0], [-105, 210], [664, -1328], [276, -552], [-1958, 0], [298, 0], [-645, 1290], [-40, 0], [-131, 262], [-28, 0], [-399, 798], [-170, 340], [470, 0], [225, -450], [780, 0], [-427, 0], [-2072, 0], [-215, 430], [-1670, 0], [-336, 672], [477, 0], [146, -292], [375, -750], [-420, 840], [-51, 102], [2463, 0], [2450, 0], [-348, 0], [-159, 318], [620, -1240], [1480, 0], [860, -1720], [1603, 0], [14, -28], [2980, 0], [-725, 1450], [84, -168], [927, 0], [686, -1372], [-135, 270], [-158, 0], [2035, 0], [756, -1512], [-2275, 0], [-1660, 0], [949, -1898], [-238, 0], [-1050, 0], [861, -1722], [-1897, 0], [430, -860], [140, -280], [-2015, 0], [796, -1592], [602, 0], [-805, 0], [455, 0], [2238, 0], [990, 0], [-20, 0], [489, -978], [-1428, 0], [1122, 0], [255, -510], [784, -1568], [-742, 0], [184, -368], [-2628, 0], [-1995, 0], [-540, 1080], [-2810, 0], [-1074, 2148], [-812, 0], [1020, -2040], [800, -1600], [784, -1568], [-519, 1038], [-735, 1470], [-2680, 0], [750, -1500], [-1532, 0], [-894, 1788], [60, -120], [-3335, 0], [3675, 0], [616, -1232], [-172, 0]]
