
# q-expansion of newform 150.12.c.f, downloaded from the LMFDB on 08 December 2025.

# 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 = 150
weight = 12
poly_data = [1, 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 = [[101, [1, 0]], [127, [-1, 0]]]
aps_data = [[0, -32], [0, 243], [0, 0], [0, 72464], [-408948, 0], [0, -1367558], [0, 5422914], [-15166100, 0], [0, 52194072], [-118581150, 0], [-57652408, 0], [0, -375985186], [856316202, 0], [0, 1245189172], [0, -1306762656], [0, -409556358], [2882866260, 0], [5731767302, 0], [0, 3893272244], [-9075890088, 0], [0, 15571822822], [30196762600, 0], [0, -23135252628], [25614819990, 0], [0, -61937553406], [-94964150058, 0], [0, -54371908448], [0, 5713477884], [49672374010, 0], [0, -177802571058], [0, -473707536136], [168573812532, 0], [0, -801479261526], [-524839237820, 0], [-1257020226870, 0], [-492117459808, 0], [0, -997091613946], [0, 484141975612], [0, 2315373820584], [0, -3371566157598], [-1645977026340, 0], [2742173271902, 0], [4084089808512, 0], [0, 4472389991422], [0, -7370248975146], [-2693084564000, 0], [6634577708612, 0], [0, 5995589013832], [0, -7749301902396], [-3758040333710, 0], [0, -9026758358298], [4022692975920, 0], [-14999667337678, 0], [-14681681636868, 0], [0, -16447633968126], [0, 19681818745272], [11617411525650, 0], [7467876506792, 0], [0, 15956443695614], [39611493918282, 0], [0, -15000063411788], [0, -38825493139158], [0, 75819366414884], [-79990659222888, 0], [0, 68561413056022], [0, 6378911616414], [89020993584092, 0], [0, 142600806741554], [0, -133725973385316], [63047442118810, 0], [0, 28974898162302], [-43310836423800, 0], [0, -112470912775336], [0, -129947513379758], [94538171865220, 0], [0, -54511744524288], [51137944162170, 0], [0, -48723411062986], [376407484129122, 0], [-312467212549610, 0], [-281729092206660, 0], [-301063838733778, 0], [346694170280832, 0], [0, -482345467463378], [-118934088249200, 0], [0, 199914264990852], [506701914104430, 0], [0, -362768435523526], [65646585500862, 0], [0, 206748343519192], [0, -379400882843916], [-367939370639280, 0], [0, 631644906594224], [278183150638332, 0], [-459050093742500, 0], [0, 915702867160632], [-1085622825947550, 0], [-163924983100278, 0], [0, -46912694264588], [-1281958508682538, 0], [0, 1105639461244004], [0, 2121608950717374], [0, 2448882915166092], [738094760695590, 0], [-21010268758708, 0], [0, 1132487353279874], [0, -2912545182972516], [0, -1529013546440658], [-2715166624101000, 0], [-2591038342922998, 0], [0, 1687610876689304], [0, 535763782489282], [0, -2843668860910086], [-814487455941980, 0], [-1458684356311168, 0], [-1162971435762798, 0], [0, -4734612318417668], [0, 5475272623688664], [0, 887970661792482], [-3144543068000100, 0], [1329822392592302, 0], [0, 6844380693513502], [0, 888819607540614], [0, -2224018428599628], [4597206126295892, 0], [-2587014691966818, 0], [-2520806909453870, 0], [-3037163189811840, 0], [0, 6520856018525024], [0, 1482084159648202], [-5393426983129460, 0], [0, -8961919068060168], [-7787200900914568, 0], [0, -2419224924478786], [-5025522575565318, 0], [-12105571636854530, 0], [0, 7456300773991722], [0, -11257989560649676], [0, -10466895892615986], [12817970979489270, 0], [9792950640539852, 0], [7084100698669542, 0], [0, -19856913386391008], [0, -20553656994225396], [14592049502444170, 0], [-6549633589083960, 0], [0, -19924415074625198], [0, 15914882431310394], [1190195095374820, 0], [0, 1733431366649952], [0, 11660223223786454], [-16609123048628718, 0], [0, 12820490726271532], [0, -221358390467016], [0, -24836086882256116], [8102951455624752, 0], [33381374096334400, 0], [-35671257106709970, 0], [0, 39624761192998394], [5371931506709022, 0], [0, 22224103394043684], [0, -7668673573745178], [0, 28047373147337984], [-24342728765789268, 0], [0, -21914442147874206], [0, 7045855376252712], [40487293131612392, 0], [0, 17960734932482174]]
