
# q-expansion of newform 1280.4.a.f, downloaded from the LMFDB on 16 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
    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 = 1280
weight = 4
poly_data = [-34, 0, 1]

# The basis for the coefficient ring is just the power basis
# in the root of the defining polynomial above.
hecke_ring_character_values = None
aps_data = [[0, 0], [0, 1], [-5, 0], [0, 1], [0, -4], [10, 0], [-42, 0], [0, 6], [0, 9], [-12, 0], [0, -22], [182, 0], [-8, 0], [0, -57], [0, -35], [346, 0], [0, -86], [-586, 0], [0, -131], [0, -38], [-58, 0], [0, 212], [0, -41], [438, 0], [-1478, 0], [512, 0], [0, -131], [0, 227], [-750, 0], [-1738, 0], [0, -437], [0, 176], [-434, 0], [0, -174], [-498, 0], [0, -110], [150, 0], [0, 461], [0, 579], [1558, 0], [0, 678], [2512, 0], [0, -666], [-874, 0], [-1426, 0], [0, 472], [0, 620], [0, -767], [0, 171], [-3772, 0], [-3590, 0], [0, 1048], [1400, 0], [0, 296], [-786, 0], [0, -521], [6446, 0], [0, 58], [-1846, 0], [-7736, 0], [0, 209], [-5730, 0], [0, 37], [0, -534], [-3158, 0], [8246, 0], [0, -616], [-3662, 0], [0, -1035], [-5316, 0], [2346, 0], [0, 1636], [0, 807], [-870, 0], [0, 2], [0, -2479], [-10138, 0], [13754, 0], [12530, 0], [9004, 0], [0, 18], [8142, 0], [0, -366], [-2142, 0], [0, 2876], [0, 429], [6428, 0], [17426, 0], [1352, 0], [0, -1937], [0, 2055], [0, 584], [0, -1187], [0, -972], [0, -26], [0, 1757], [-10652, 0], [2782, 0], [0, 1553], [-21128, 0], [0, 2579], [25482, 0], [0, -1079], [3788, 0], [0, 3464], [-12362, 0], [0, 2385], [16866, 0], [0, -2212], [-336, 0], [0, 3397], [4558, 0], [12066, 0], [0, 3190], [0, 1150], [31024, 0], [0, 139], [0, -2211], [14918, 0], [0, 458], [13330, 0], [-14782, 0], [-5634, 0], [0, 3503], [0, 3272], [-24406, 0], [-30900, 0], [0, -3720], [0, 1265], [-15226, 0], [0, 1958], [0, 1923], [0, 690], [29146, 0], [-10462, 0], [-9106, 0], [-35474, 0], [0, -4207], [34126, 0], [-20250, 0], [0, -6376], [-27006, 0], [0, 5041], [0, -2691], [-22802, 0], [0, -6372], [4206, 0], [-11586, 0], [0, -6390], [0, 5851], [34094, 0], [7232, 0], [0, -735], [0, 7681], [0, 7175], [0, 1746], [0, -7420], [35604, 0], [-43390, 0], [41232, 0], [0, -7643], [-22054, 0], [0, 527], [0, -6060], [2682, 0], [0, 959], [0, 9038], [37122, 0], [-33346, 0], [-24738, 0], [0, 2578], [1304, 0], [0, -7194], [-39082, 0], [0, 2372], [-34006, 0], [0, 8500], [-18600, 0], [0, 3025], [-13686, 0], [0, -49], [0, 924], [-10094, 0], [-25618, 0], [0, 5619], [-29644, 0], [11610, 0], [0, -4949], [-22476, 0], [0, -5294], [-54018, 0], [0, 1925], [0, 1052], [21930, 0], [0, 6393], [13602, 0], [-75856, 0], [-81842, 0], [31010, 0], [0, 7989], [-36852, 0], [0, -686], [48722, 0], [-73778, 0], [0, 5742], [-49266, 0], [0, -13032], [0, -3789], [20170, 0], [0, -13760], [-43226, 0], [-51026, 0], [0, 2767], [0, -14023], [0, 11436], [23024, 0], [0, 8787], [-68742, 0], [0, -5637], [12522, 0], [-19278, 0], [0, 8732], [12162, 0], [0, -3475], [0, 5361], [-4238, 0], [27870, 0], [0, 1500], [0, 3455], [0, -11784], [-53326, 0], [0, -9190], [0, -10854], [88744, 0], [0, 3771], [0, 13283], [-1820, 0], [1082, 0], [0, -5418], [0, -9658], [0, -16561], [0, -5080], [0, -5869], [27876, 0], [56050, 0], [0, 13972], [0, 2739], [0, -16548], [0, 6970], [0, -10889], [-17646, 0], [60374, 0], [0, -7075], [-9708, 0], [22662, 0], [0, -21354], [-14120, 0], [0, -20051], [70162, 0], [-63646, 0], [0, -16917], [0, 3427], [-50828, 0], [90218, 0], [102462, 0], [0, 4886], [-92292, 0], [12362, 0], [0, -7747], [-11858, 0], [41416, 0], [0, 6159], [-53950, 0], [0, 3820], [65638, 0], [0, 8243], [0, -9849], [28316, 0], [-39760, 0], [0, 20664], [0, -11901], [0, -17318], [0, 13175], [-69312, 0], [0, -8247], [0, -3834], [115454, 0], [-75594, 0], [0, 17912], [103836, 0], [-7130, 0], [0, -10127], [71086, 0], [0, -3652], [-113338, 0], [77414, 0], [0, -21474], [-12626, 0], [0, -5430], [0, -1681], [-149594, 0], [-24378, 0], [0, 27464], [0, 3771], [0, -2628], [-36654, 0], [0, 14399], [105460, 0], [0, 3252], [-18458, 0], [0, -12911], [40100, 0], [65958, 0], [0, -3807], [0, 9707], [32982, 0], [0, 29490], [0, 13830], [-35338, 0], [-87196, 0], [0, 6548], [-129410, 0], [65222, 0], [0, 13463], [29766, 0], [17232, 0], [0, -14518], [0, 9589], [0, -1019], [206034, 0], [-172362, 0], [-80730, 0], [0, 33028], [0, -385], [0, 6160], [0, 12147], [174706, 0], [-156890, 0], [-177672, 0], [0, -14103], [160422, 0], [163410, 0], [144282, 0], [0, -22294], [131074, 0], [0, 28334], [186926, 0], [0, -7275], [0, -28214], [-72418, 0], [0, -11800], [8426, 0], [-196758, 0], [0, 15245], [-89836, 0], [117486, 0], [0, 22916], [0, -17480], [-182790, 0], [0, 14811], [-81990, 0], [84606, 0], [0, 9535], [0, -18458], [0, -15967], [-161446, 0], [-130566, 0], [0, 15919], [-93352, 0], [0, -7944], [0, -17086], [0, -3257], [182090, 0], [0, 24410], [-58574, 0], [0, -33310], [0, -4950], [-123590, 0], [-38060, 0], [-106250, 0], [-221160, 0], [72342, 0], [0, 32223], [-94014, 0], [0, 14738], [0, -31383], [0, -6982], [-64362, 0], [0, -30227], [0, 40685], [-187636, 0], [-33022, 0], [0, -17786], [0, 5263], [0, -23158], [-156602, 0], [0, -45548], [-92938, 0], [0, 33432], [100398, 0], [223366, 0], [-168642, 0], [0, 33751], [9422, 0], [182646, 0], [0, -45326], [-87258, 0], [-168630, 0], [0, -6201], [0, -47514], [142250, 0], [-222802, 0], [0, 41001], [0, -20344], [65654, 0], [-145192, 0], [0, -25984], [0, -21261], [-138606, 0], [0, 46971], [122426, 0], [-142530, 0], [0, 20581], [0, 49490], [-221702, 0], [-140682, 0], [0, 25387], [38676, 0], [0, 9872], [0, -28724]]
