
# q-expansion of newform 320.6.a.f, downloaded from the LMFDB on 18 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 = 320
weight = 6
poly_data = [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], [-6], [25], [-118], [-192], [-1106], [762], [2740], [1566], [-5910], [-6868], [5518], [-378], [2434], [13122], [9174], [34980], [9838], [-33722], [70212], [21986], [4520], [109074], [38490], [-1918], [-77622], [-46714], [1038], [-206930], [139386], [299882], [-7872], [-164238], [282100], [388950], [-97948], [3718], [43234], [186522], [374454], [-272100], [75418], [-356988], [-438694], [156798], [-162520], [181648], [-288274], [-1125522], [415810], [770586], [-595320], [273902], [-850752], [825402], [1364646], [113310], [-849628], [-438602], [-1456698], [120394], [2642094], [1447558], [-928068], [2295626], [-2736522], [-3818792], [-2210878], [2327238], [311290], [-3086574], [-3530760], [35762], [1715254], [3101740], [5319486], [-1161450], [-628562], [-2724318], [1780190], [-650580], [3540598], [-548748], [-1492414], [4862120], [1861554], [3737190], [-6482758], [-1509102], [8684006], [-6964122], [-5510520], [5518082], [1512768], [1930420], [6731046], [556650], [10111002], [7037194], [4231138], [-4440242], [9014478], [9812874], [13315230], [-9958952], [4503722], [-625842], [-2503854], [-756480], [-13856458], [11377202], [7001614], [7903002], [-4023620], [-10022668], [6373902], [-5004566], [-8719278], [1584774], [-12640980], [3615718], [11131346], [235518], [-20583006], [9548248], [-1293042], [21272050], [8317320], [-4367398], [4056454], [-768260], [6187806], [18169772], [-19349402], [-30199158], [21585410], [-3908946], [26508238], [-10794042], [-11144550], [11486608], [-30434682], [4097726], [17065158], [24761710], [31652880], [-28267106], [26086962], [33811060], [22281726], [34674838], [14260302], [37517674], [40765722], [35711638], [-21138948], [18599600], [44511030], [-21941878], [7777218], [-31719882], [-5602854], [-20353198], [23430648], [-43041198], [-47500314], [20923052], [-29633162], [33762290], [52045374], [-4833300], [25518178], [12907452], [47092706], [-33795280], [-33788790], [46590808], [-49505382], [-17971954], [-42585890], [35301362], [54443088], [-41526746], [15509442], [-19362354], [-7206030], [62773918], [-48502166], [-22644610], [-8918148], [51496106], [10319874], [47238088], [18784398], [-16954962], [-53922534], [-82445458], [49484374], [-9381918], [-18177834], [-33983190], [19241012], [-34901402], [66999890], [7232820], [-42271242], [59488160], [-114511206], [106004250], [7626088], [-97407718], [8569638], [35123846], [75097998], [-119447280], [-87537418], [28429082], [10674642], [-3074598], [-103772706], [26137078], [98917280], [-43338990], [-42033994], [73752798], [44057830], [-114037374], [-26305920], [-40565038], [111360888], [-4185506], [-36880220], [143290772], [-2848458], [-28983206], [-10830198], [-28413850], [48856614], [-129700020], [83924652], [147524514], [-88378112], [-52580914], [97773370], [-169894494], [114384120], [35630042], [4355688], [-54549260], [132732966], [46804798], [186730002], [118885602], [-95747890], [-76020426], [-39356700], [11696458], [-45045482], [-3559962], [-164816998], [20800286], [142661118], [111723970], [-96579266], [-174425238], [162426820], [-202741590], [21016842], [218346994], [94741854], [-233150222], [10570438], [-13959814], [-12863440], [-53488918], [65455646], [-180826602], [-155118470], [10399142], [5904048], [-59155314], [-219673108], [-149307438], [15570058], [-227238722], [73530252], [-154360294], [122996718], [-262708720], [224509110], [18283038], [-154097922], [86432946], [-283210032], [-107693546], [4017630], [115697852], [-71198946], [147377100], [-297782282], [-202502254], [-112341402], [31374920], [-14543286], [3372448], [-58584958], [-36752922], [-155948870], [85280760], [-129268466], [-267668754], [240758130], [-39973278], [345974794], [-67077078], [3558890], [53106900], [-166767108], [328200026], [124147830], [139161688], [285989282], [-123716082], [317436086], [158430786], [328377662], [160036900], [-251461886], [110653842], [179156934], [338611198], [250537158], [-185893960], [254352834], [-164896112], [302634318], [-72827330], [340794906], [-97194538], [-123252118], [-272153906], [340944522], [471712710], [244166372], [-12013986], [-499909020], [-153351722], [-100551722], [-73877748], [-325758402], [132378928], [-207367318], [-88681602], [373844246], [-151358030], [-331828014], [459427560], [120463848], [-123635598], [79629006], [-362516282], [466768362], [439421202], [98677140], [-53442962], [-253819414], [88777038], [-7733674], [-217174858], [-16583472], [337060300], [-519876954], [526174710], [480919172], [354960958], [71260260], [-567810948], [558089426], [348239910], [12648482], [242674818], [-136684014], [535179122], [285775122], [-414832460], [-472561314], [-100271308], [354775198], [-92875886], [349897842], [188181590], [-654524826], [-188560620], [-143095082], [-439934028], [-692791054], [-9153880], [-169813350], [-524406752], [548777478], [-165444290], [-234523494], [515304242], [364356402], [-734333130], [-623235868], [780364918], [-697765038], [-712860686], [-581521140], [-82711534], [130656318], [169010154], [405201568], [-663984718], [-29390862], [-490175520], [-611985718], [55741602], [-8762274], [640537230], [-702267122], [656474562], [71959860], [321952106], [234260118], [-219015606], [382102590], [-414421832], [-880978680]]
