
# q-expansion of newform 288.8.a.f, downloaded from the LMFDB on 11 June 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 = 288
weight = 8
poly_data = [-435, 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], 1], [[0, 48], 1]]

hecke_ring_character_values = None
aps_data = [[0, 0], [0, 0], [-140, 0], [0, 1], [0, 4], [-2238, 0], [-1144, 0], [0, 14], [0, 88], [41324, 0], [0, -183], [-137594, 0], [-123848, 0], [0, 638], [0, -776], [981068, 0], [0, 568], [1004750, 0], [0, -1084], [0, 2336], [603798, 0], [0, 1833], [0, 2284], [6185104, 0], [-6619986, 0], [11975740, 0], [0, 12011], [0, -19288], [-1552254, 0], [29106448, 0], [0, -32173], [0, 35616], [46519496, 0], [0, 50948], [64542980, 0], [0, 18017], [59063854, 0], [0, -18962], [0, 38520], [66135892, 0], [0, -138056], [36448938, 0], [0, -28408], [-73772942, 0], [135978796, 0], [0, 101207], [0, -127324], [0, 100783], [0, 174740], [273131610, 0], [-106941328, 0], [0, 253304], [-242704770, 0], [0, 38772], [-100712416, 0], [0, -218816], [-481689380, 0], [0, -280001], [310252266, 0], [-378650912, 0], [0, 106264], [-399019252, 0], [0, 974020], [0, 151344], [-850217302, 0], [-807844724, 0], [0, -926216], [-511969266, 0], [0, 319052], [514972430, 0], [-882436592, 0], [0, 1023744], [0, 1678585], [866573942, 0], [0, -666210], [0, -2162136], [-136650940, 0], [1246815326, 0], [-571616680, 0], [-223726026, 0], [0, -1482316], [541576410, 0], [0, 2130584], [449648962, 0], [0, -63417], [0, -2175476], [1279964200, 0], [-135409434, 0], [1730146340, 0], [0, -1360957], [0, 2929252], [0, 1300064], [0, -1615723], [0, 2811712], [0, 3302168], [0, -3014128], [3575969756, 0], [5826599960, 0], [0, 3477150], [472441362, 0], [0, -6839622], [2480597684, 0], [0, -5787388], [2234566040, 0], [0, -4439836], [6841176194, 0], [0, 1453344], [5042066672, 0], [0, 3860680], [4901922010, 0], [0, -2683565], [-5679195802, 0], [-2802362144, 0], [0, 6763704], [0, 7629669], [-9782899192, 0], [0, -7159206], [0, -687032], [-460570652, 0], [0, 805456], [-11550478730, 0], [6670242962, 0], [-7257294236, 0], [0, -13308892], [0, 11512462], [-5656136452, 0], [-6967231590, 0], [0, -12317040], [0, -15051595], [5627786418, 0], [0, -12243964], [0, -2598152], [0, 16687605], [-8034579414, 0], [-6725684120, 0], [19732907570, 0], [-3493215748, 0], [0, 21485250], [-12968453756, 0], [109559176, 0], [0, -22420302], [-17440922132, 0], [0, -3309987], [0, 899656], [9906257394, 0], [0, 241344], [-6663837482, 0], [-7035951176, 0], [0, -18307278], [0, 8144312], [25051863614, 0], [27373386272, 0], [0, 6109614], [0, -34636656], [0, 23060330], [0, -33838600], [0, -5577091], [-16670004520, 0], [-28692575606, 0], [13075393700, 0], [0, 587304], [32728105208, 0], [0, -40221733], [0, 12101348], [47082586744, 0], [0, 18624752], [0, 3681005], [-74352826, 0], [-2586944130, 0], [24278190148, 0], [0, -7760304], [60843193582, 0], [0, -34818968], [-56955192042, 0], [0, -1983435], [46287862336, 0], [0, -33823056], [38297980100, 0], [0, 49051031], [70117481566, 0], [0, 1544089], [0, -63201748], [-41265645702, 0], [55142546656, 0], [0, -20523928], [-60405683516, 0], [43963702674, 0], [0, -25328808], [-48371061114, 0], [0, -82842928], [23923300542, 0], [0, 50807016], [0, -101142928], [-85670394412, 0], [0, 24003984], [9882173888, 0], [49497806930, 0], [74995158258, 0], [-110435530784, 0], [0, 44109408], [-42070675244, 0], [0, 31904599], [-64771636374, 0], [51070034910, 0], [0, -107931188], [41892448684, 0], [0, -87014193], [0, 56929700], [-108498930064, 0], [0, -84923982], [97729038434, 0], [-48398374748, 0], [0, 15233071], [0, -117294072], [0, -49625904], [-20427633350, 0], [0, 30755545], [-158726920280, 0], [0, -128802168], [-47845690988, 0], [-171417250470, 0], [0, -24042913], [17307191864, 0], [0, -113453], [0, -53681604], [-181980113066, 0], [-65508619408, 0], [0, -33999568], [0, 57115699], [0, 70264384], [-90198310398, 0], [0, -132037758], [0, 229872363], [-6025063648, 0], [0, -141799222], [0, 185382336], [170153927646, 0], [128604045092, 0], [0, 67345204], [0, 126904664], [0, -178906044], [0, 38422832], [0, -235164611], [85013540350, 0], [161636447168, 0], [0, -207336928], [0, -151050899], [0, -158173880], [0, -108307496], [0, -38386816], [-185853946926, 0], [266030254160, 0], [0, 82000424], [-35039413866, 0], [-47764652612, 0], [0, 223364616], [-154882711158, 0], [0, -1484180], [238354196636, 0], [8284088554, 0], [0, 86997543], [0, 139199608], [-174865120230, 0], [-74869890482, 0], [290606429944, 0], [0, 36630000], [201679789924, 0], [-154147846960, 0], [0, -169267670], [226784734052, 0], [24804761342, 0], [0, -440326004], [-300797034138, 0], [0, -41413547], [224411964846, 0], [0, 319611383], [0, -145164996], [104734410830, 0], [-175258371670, 0], [0, 299847736], [0, -307072400], [0, 282020895], [0, 165186040], [348754555142, 0], [0, -87488910], [0, 225488032], [-215201836578, 0], [150953218964, 0], [0, 31185777], [118636577200, 0], [-317629321148, 0], [0, -171119816], [-330996302192, 0], [0, 517928088], [247794410782, 0], [-335006714140, 0], [0, -501332517], [-389073670052, 0], [0, 463974748], [0, -161398150], [81391703962, 0], [-56841368044, 0], [0, -382083051], [0, 420105776], [0, 122942390], [-577426321746, 0], [0, 359566148], [-280008689310, 0], [0, 255871184], [571611035558, 0], [0, -170193080], [-324647697956, 0], [-518494222040, 0], [0, -6872666], [0, -691679536], [-58066219530, 0], [0, -801376032], [0, 727340768], [-567719517378, 0], [-204730732720, 0], [0, 626861592], [222842522506, 0], [-378598790068, 0], [0, -19702383], [256329018488, 0], [-333743248770, 0], [0, -793754842], [0, -747134754], [0, 448526528], [-77278290188, 0], [397445951970, 0], [423434363956, 0], [0, 635860535], [0, 679641544], [0, 11564804], [0, 869998524], [-333747753266, 0], [632470768112, 0], [634267953270, 0], [0, 1067174963], [276753106198, 0], [808903493656, 0], [842825733820, 0], [0, -1071532877], [775126855772, 0], [0, 68577300], [510657440730, 0], [0, 16087664], [0, -712893616], [537328427996, 0], [0, 5128546], [678985213926, 0], [-393794623508, 0], [0, 557988959], [-480129318410, 0], [-40920427072, 0], [0, -316054136], [0, -257182912], [694150651016, 0], [0, 502027568], [1159252801894, 0], [564656054320, 0], [0, -766197112], [0, -244103300], [0, -20837940], [673148367818, 0], [1315182188684, 0], [0, -919591559], [1224695745290, 0], [0, -93601028], [0, 834764286], [0, 927657888], [1053133425260, 0], [0, 393663021], [-1305671300526, 0], [0, 353690996], [0, 1449810536], [29146316002, 0], [203421974360, 0], [274464562134, 0], [-313638291980, 0], [-319078170488, 0], [0, 32599353], [807821909024, 0], [0, -1646001982], [0, 1006172312], [0, 100502429], [-1515545008566, 0], [0, -683981844], [0, -1605140152], [-302446603074, 0], [979125771268, 0], [0, 483492816], [0, -1223362506], [0, -1782128056], [2028993091638, 0], [0, -913215425], [417036978904, 0], [0, 564328262], [-1617156496172, 0], [-1799895235666, 0], [-1824765815912, 0], [0, -677133301], [99277610776, 0], [-806726939860, 0], [0, 292070617], [-155970322014, 0], [-649397473960, 0], [0, 209306470], [0, -1092631500], [-1087626628558, 0], [1633934296436, 0], [0, -753553340], [0, 690153014], [2274330702774, 0], [-2265213704500, 0], [0, -482929272], [0, -1165018207], [-602181631784, 0], [0, 2498753280], [-68511869980, 0], [1568634353926, 0], [0, 2131440064], [0, 2198756852], [16590640858, 0], [-137447331316, 0], [0, 747560132], [-355938410800, 0], [0, 77837074], [0, -1713135288]]
