
# q-expansion of newform 252.4.k.f, downloaded from the LMFDB on 24 June 2026.

# 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 = 252
weight = 4
poly_data = [2304, 48, 49, -1, 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, 0, 0], 1], [[0, 1, 0, 0], 1], [[2304, -49, 49, -1], 2352], [[97, 0, 0, 1], 49]]

hecke_ring_character_values = [[127, [1, 0, 0, 0]], [29, [1, 0, 0, 0]], [73, [0, 0, -1, 0]]]
aps_data = [[0, 0, 0, 0], [0, 0, 0, 0], [0, -1, 6, 0], [-1, 2, 1, 3], [1, -7, 6, -7], [0, 0, 0, 5], [52, -4, -48, -4], [0, 3, -35, 0], [0, -20, 48, 0], [-143, 0, 0, 11], [-171, -20, 191, -20], [0, -45, 25, 0], [72, 0, 0, 18], [362, 0, 0, -3], [0, -36, -90, 0], [243, 9, -252, 9], [113, -53, -60, -53], [0, -40, 286, 0], [-94, 77, 17, 77], [-778, 0, 0, -44], [-634, 53, 581, 53], [0, 62, -761, 0], [755, 0, 0, -101], [0, 42, -1008, 0], [295, 0, 0, -29], [2, 184, -186, 184], [0, 111, 457, 0], [0, 207, 72, 0], [-46, -31, 77, -31], [-872, 0, 0, 110], [1233, 0, 0, -106], [0, 335, 6, 0], [278, -2, -276, -2], [-182, 0, 0, 181], [0, -78, -2268, 0], [-451, -301, 752, -301], [-1052, 402, 650, 402], [0, 96, -1484, 0], [2374, 0, 0, -4], [0, -490, 312, 0], [876, -246, -630, -246], [2664, 0, 0, 209], [0, 18, -3402, 0], [2203, 378, -2581, 378], [1334, 0, 0, 202], [628, -132, -496, -132], [-2062, 0, 0, 378], [1457, 0, 0, -609], [-5793, -57, 5850, -57], [0, -107, -1193, 0], [0, -434, -3066, 0], [588, 0, 0, 618], [553, -903, 350, -903], [543, 0, 0, -327], [0, 336, -4374, 0], [5778, -54, -5724, -54], [-6061, 379, 5682, 379], [0, -55, -1712, 0], [5488, -393, -5095, -393], [3590, 0, 0, -722], [158, 971, -1129, 971], [825, 0, 0, -177], [76, 0, 0, -143], [-8152, -194, 8346, -194], [0, 526, 2425, 0], [0, 735, -4248, 0], [0, -543, 307, 0], [-2871, 0, 0, 164], [2940, 372, -3312, 372], [1042, 0, 0, -200], [-6312, -582, 6894, -582], [0, 326, -6996, 0], [967, -840, -127, -840], [0, 883, -203, 0], [2584, 0, 0, 169], [0, 274, 6780, 0], [-106, 1516, -1410, 1516], [0, -385, 925, 0], [0, 540, 3564, 0], [-5807, 450, 5357, 450], [-1968, 0, 0, 726], [3774, 0, 0, -1225], [-444, 174, 270, 174], [6686, 0, 0, -1359], [0, -1471, 256, 0], [0, -791, 4836, 0], [2896, 0, 0, 626], [0, 598, -10157, 0], [4246, 0, 0, -346], [6736, 0, 0, 1081], [0, -406, 1986, 0], [7126, -490, -6636, -490], [-7829, 468, 7361, 468], [-6837, 0, 0, 249], [0, 397, -12767, 0], [4152, 0, 0, -354], [0, -1671, -8118, 0], [4158, -2322, -1836, -2322], [0, -3, 3067, 0], [0, 491, 2239, 0], [6252, 0, 0, -760], [-4747, -1007, 5754, -1007], [12949, 221, -13170, 221], [0, -1446, 13590, 0], [30, -797, 767, -797], [3473, -1744, -1729, -1744], [5225, 0, 0, 2359], [0, 1194, -10566, 0], [3786, 426, -4212, 426], [3467, 0, 0, -156], [0, 116, 16927, 0], [-7212, -1790, 9002, -1790], [6902, 0, 0, -1856], [9206, -151, -9055, -151], [-13555, 0, 0, -1845], [7714, 1550, -9264, 1550], [-8626, 0, 0, -1527], [9030, -264, -8766, -264], [0, 2091, -342, 0], [-2056, 0, 0, 1324], [-5266, -1417, 6683, -1417], [7277, 0, 0, -582], [0, 1581, 7020, 0], [-22197, -303, 22500, -303], [0, 2001, 4303, 0], [21841, 0, 0, -49], [0, 984, 19882, 0], [0, 552, 17442, 0], [-19529, 0, 0, 166], [0, -397, -16805, 0], [-17274, 2503, 14771, 2503], [9306, 0, 0, -4176], [0, 1814, 13813, 0], [7770, 0, 0, 2744], [0, -1208, 3360, 0], [4573, 0, 0, -1166], [-1150, 2020, -870, 2020], [18114, -1178, -16936, -1178], [14607, 0, 0, 1305], [32504, 262, -32766, 262], [19186, 0, 0, -3698], [0, 553, -15270, 0], [19592, -3928, -15664, -3928], [11355, 0, 0, 1263], [11960, 491, -12451, 491], [-24364, 0, 0, 3328], [-20338, 0, 0, -615], [-23034, -2886, 25920, -2886], [0, -2094, 10648, 0], [0, 2852, -8058, 0], [0, -686, 18094, 0], [-24462, 0, 0, 1926], [-22960, 0, 0, 297], [0, -1518, 15714, 0], [-13644, -3245, 16889, -3245], [28026, 0, 0, -3330], [0, -2183, 21271, 0], [0, -6132, -6498, 0], [17435, 0, 0, 5004], [5729, -3221, -2508, -3221], [0, 14, 6306, 0], [9470, 0, 0, -2426], [9683, 0, 0, -3606], [0, -3129, -8244, 0], [35394, -2868, -32526, -2868], [28572, -1104, -27468, -1104], [7129, 3408, -10537, 3408], [2218, 3039, -5257, 3039]]
