
# q-expansion of newform 450.6.a.m, 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 = 450
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 = [[4], [0], [0], [-176], [60], [658], [-414], [956], [600], [-5574], [-3592], [8458], [-19194], [-13316], [-19680], [-31266], [-26340], [-31090], [16804], [-6120], [25558], [74408], [-6468], [32742], [-166082], [22002], [79264], [227988], [-8530], [-195438], [-173000], [-151260], [-128454], [154196], [-29454], [-203872], [-136142], [171124], [-676200], [133158], [693396], [377174], [265344], [-295298], [201294], [652448], [-1147060], [-701960], [1236108], [105830], [-438678], [-28464], [892562], [110124], [140802], [-938760], [1114506], [567704], [1213258], [-687738], [830908], [-1312626], [-1690220], [1502040], [-810842], [903558], [1121972], [2752174], [1917492], [1836590], [-622014], [-3740616], [-16232], [-293606], [3180116], [-2979840], [-3459774], [3904162], [-5441154], [1969946], [-139020], [4327430], [2799360], [5902414], [-446512], [3495252], [1206126], [-233546], [1744890], [2917864], [-5310756], [-2344656], [-9815312], [5945196], [6478316], [4717944], [1907706], [-8019738], [-1911620], [-11990050], [-4458092], [9026118], [6848988], [5463222], [-10232380], [-15943682], [-9477132], [2453490], [9299784], [-11461702], [-11278376], [-93782], [-14964150], [-5068876], [15591872], [-10970130], [2837044], [-6056856], [-1088922], [-7418028], [767654], [-1422626], [-6162306], [15062148], [-5876356], [-3600774], [9225158], [26392320], [9794848], [-4075838], [-16570852], [14414136], [16794440], [-13294262], [2147862], [-13105918], [-23715378], [8400484], [5410230], [26077734], [19002116], [31017282], [15628960], [15842052], [2061758], [-30390024], [29773786], [8641002], [-33566284], [39019104], [18138178], [-30531186], [43553284], [-13415160], [-3108164], [-1190352], [-47199616], [-1335954], [-14723786], [26919642], [-3731604], [21873546], [-17602496], [-16731684], [55538178], [-38678424], [9584984], [10365034], [-15326638], [-2400114], [-6185028], [-49247506], [-31599384], [-44534570], [58310216], [41260422], [69004868], [-1073502], [-42406112], [10636574], [30311752], [72877812], [17593210], [-4900374], [32915760], [-54190254], [-49039742], [-712508], [-73548694], [-12093696], [-36530498], [-15155628], [-10480948], [-71216310], [-46421316], [-15499254], [80400050], [-15166814], [35567490], [101093976], [53886522], [-71197672], [-2354678], [-46040926], [62451900], [-11026170], [15583880], [95301708], [-87798090], [-83244988], [-38354258], [-75785262], [54179536], [7896900], [68570328], [-96508534], [-89079560], [52890846], [46727784], [-132937194], [80891270], [63682640], [6919950], [66683752], [-50614788], [4946342], [66766746], [92859120], [-62179520], [52396332], [89568658], [94457180], [50557544], [-108395178], [-72794372], [-84509664], [-60806350], [57180366], [-84863508], [57666168], [43822236], [55033220], [-89499248], [87949118], [39559506], [-160722552], [82349512], [-78933084], [-34183468], [-51019344], [-78276158], [104437854], [104077032], [-180401494], [-183988554], [135176148], [-111151114], [35388508], [-24678738], [102038758], [16592440], [90300828], [58884902], [31358194], [50403282], [-17135716], [109142010], [-145435962], [217276876], [-34810626], [88169246], [-104448620], [18036166], [-127777960], [-86618546], [-129914768], [-124533516], [-158124082], [59282858], [74600340], [140748432], [35859680], [-112601832], [-194050570], [-157434596], [-184801104], [47957326], [-86917458], [79612448], [26687934], [-37892550], [55124460], [230903034], [237963180], [198699394], [120638442], [-280168024], [271671582], [-314239860], [-50615852], [-169836650], [-121845978], [165519560], [-280374708], [106271828], [-314137154], [-282596892], [269653454], [-245242968], [-267256694], [224602032], [-274803966], [129917454], [119094868], [-96145992], [-10248694], [268974132], [-380189904], [-338688770], [256543950], [-67703476], [228632518], [81075834], [253261384], [-181632966], [-328443118], [59611340], [-327209684], [344787168], [-177756066], [29330222], [402617526], [68534312], [-173703300], [-359802412], [-260819244], [93198926], [-218038782], [-117341686], [-16163480], [-171839174], [-9740022], [-56169582], [-225865120], [105100518], [60300756], [214202918], [335148844], [-205006368], [262532862], [-114689620], [-82573130], [344564778], [-214957112], [-280015066], [64262394], [536671488], [-34643412], [-133340286], [13732392], [109198570], [289362678], [255576240], [129080940], [-279872732], [389435062], [435560790], [156936112], [475554746], [-34835916], [-483381916], [45054672], [3584418], [531304640], [480935842], [-244960764], [-473633568], [-406618274], [-297322722], [373236934], [-30900918], [19103226], [-118841312], [359587938], [650502188], [-622609128], [16848968], [194291434], [4410268], [-542804304], [159539522], [640721694], [-116268372], [605144452], [284134776], [183521062], [193659752], [632961798], [564867620], [-59527086], [-118691506], [-394865550], [224410888], [-644836566], [635837490], [-17110096], [-168228014], [-371278434], [69505444], [-604745292], [720944878], [142904046], [-661129740], [-265467316], [-450993482], [431408106], [-261454464], [-198750992], [-189979902], [-673839624], [85286058], [-870776246], [112161072], [-274409268], [214654678], [609534582], [369797916], [-395106714], [-812417740], [120774984]]
