
# q-expansion of newform 1152.4.a.m, downloaded from the LMFDB on 27 December 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 = 1152
weight = 4
poly_data = [-7, 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, 4], 1]]

hecke_ring_character_values = None
aps_data = [[0, 0], [0, 0], [-8, 1], [-2, -3], [12, 2], [38, -4], [10, -2], [16, 10], [36, -2], [-220, -5], [-218, 5], [-94, 6], [2, -38], [296, -2], [212, 26], [-204, 39], [-116, -24], [306, 10], [492, -8], [284, -2], [182, 36], [310, 61], [156, -78], [686, 60], [890, 20], [1028, -29], [298, -57], [1156, 52], [62, -32], [46, -132], [1410, -97], [540, 144], [1882, 118], [756, 200], [296, -263], [1142, 57], [-862, -26], [480, -10], [-3216, -80], [136, 233], [-444, -72], [-2274, -200], [2584, 184], [814, 204], [572, 155], [2162, 59], [2236, -320], [-1550, 287], [-1780, -122], [-634, 348], [3110, -140], [1744, -436], [2526, -56], [2812, -382], [1166, 88], [-2984, 272], [-2844, -401], [5970, -185], [3278, 424], [-6274, 256], [1436, -56], [-2396, -225], [1788, -360], [1312, -500], [3622, -228], [2828, -125], [7692, 212], [-3986, 516], [-204, 66], [-222, -238], [1742, 100], [1868, -810], [-282, 389], [1458, 170], [9720, -206], [6328, -712], [-2152, -235], [2042, 1018], [-2478, -198], [-5646, -404], [-6644, -402], [4782, 560], [-7444, 206], [-4174, -704], [-11526, 63], [4356, 402], [2842, -402], [-1070, 596], [-5320, 785], [9050, 651], [3068, 78], [6628, 830], [814, 541], [-5092, -844], [-11564, -104], [-4292, -194], [13228, 543], [4986, 682], [-10936, 42], [8678, 1080], [4552, -1518], [-12832, -63], [5316, -1302], [2882, -1462], [4292, 1092], [-6378, -196], [7164, -1508], [13134, -180], [-12580, 1354], [254, -908], [-12270, 463], [-14494, -774], [-5954, 1744], [-13172, 360], [-8802, -379], [-27918, 342], [-6296, 674], [9300, 774], [-7648, 181], [8804, 1516], [1770, -178], [-382, 200], [10432, 589], [10500, -1122], [24064, -298], [-7268, -1397], [17558, -1132], [2588, 370], [3222, 1593], [7102, 1388], [524, 196], [-392, -692], [-13610, 573], [2646, 2188], [-1182, 902], [20062, 580], [-3060, -1857], [4328, -2250], [6480, 1833], [9162, -1842], [19856, -362], [-34068, -737], [20854, 273], [-14604, -628], [20798, -1056], [21428, 706], [-3462, -3242], [-6990, 690], [-5856, 538], [-3352, 2504], [-16958, 2202], [-8626, -544], [10880, 1094], [-19304, 2240], [2800, -974], [-7664, 1628], [-4154, -847], [21858, -1014], [41130, 208], [-20488, 1313], [-29756, 232], [17514, 3626], [32418, -901], [12948, 1510], [1170, -1686], [2472, -1912], [12342, 2069], [2682, -1206], [-22182, -4], [12528, -4175], [-20596, -3140], [16546, -2026], [48824, 212], [-19926, 3440], [-13762, 609], [-37586, -160], [-4772, -4840], [-20312, 793], [42458, -1297], [-31590, -2186], [-3514, -627], [23148, 42], [-2034, -4548], [18446, 288], [-21560, 2984], [-15856, 3985], [-48434, 1500], [15540, -4912], [-2794, 1256], [12608, -2344], [-25198, 3992], [7404, -1776], [-42956, -264], [1600, 4549], [18860, 1248], [-5282, -48], [33670, -2372], [20734, 1204], [-6666, 7192], [22624, 3500], [1384, -4883], [-61686, 1315], [-4538, -1352], [-15218, 4692], [3948, 2934], [47532, -345], [42730, 2683], [3316, 5410], [-34810, 1220], [-2400, -1958], [44622, 3380], [4592, -3139], [41226, -337], [-30756, 2432], [-8988, -1854], [9418, -2448], [-30850, -1919], [-462, -5122], [45408, 1368], [53640, 2445], [29734, -3456], [-27198, 27], [-80038, -230], [-17470, -3089], [-61060, 3474], [24362, 4838], [20958, 4780], [-19772, 6070], [1562, -3561], [-44852, -1964], [-25026, 1912], [-11800, 2514], [-34758, 451], [46478, -1512], [-28384, 3498], [61076, -706], [13210, -5636], [-47112, -367], [31268, -1562], [85316, -938], [-44604, 3690], [67692, -1876], [-3258, 1409], [73826, 1758], [-26682, -4888], [-38908, 1778], [5966, -3295], [-74756, 20], [-32388, -7508], [45064, 4388], [68430, 1200], [-11618, -2180], [-38236, -6514], [-10566, 7816], [38932, 2331], [-19732, 2132], [-27770, -240], [-90668, -3124], [-26852, -4909], [-67142, 416], [-6334, 9767], [6196, -3912], [49558, -1296], [-17886, 5182], [-17270, 5546], [-68860, -5372], [-36464, 2049], [18502, 6308], [101472, -2066], [124840, -71], [51826, 7554], [-66340, 1236], [-49926, 256], [-27666, 4897], [-75358, 4000], [39858, 3859], [-73780, -34], [-2198, 2354], [-58018, 1252], [73548, -2988], [-85820, -2378], [2170, -1497], [-21652, -7814], [-54222, 2162], [16576, 1110], [65096, 5348], [17774, -3040], [-39536, -1699], [55118, 861], [72718, -6524], [-107984, -2811], [3780, 11472], [38030, 3532], [-13284, -8208], [-114326, -698], [114552, 897], [-43206, -4885], [-94332, 2395], [-15140, 4166], [53320, -4530], [-410, -5036], [-51904, -4571], [37630, 2081], [-59060, 4664], [42904, 9294], [-38434, -9032], [412, 3874], [-74946, 524], [38916, 4746], [39634, 970], [-17192, -14496], [-106668, 7155], [-130190, 4910], [8288, 15986], [86800, -2276], [15274, 7064], [-152380, 1700], [10268, 11954], [31774, 500], [-22362, 15748], [99684, 8528], [139030, 2644], [628, -1885], [-2858, 11181], [53746, 2258], [-5686, -972], [14736, -12174], [-76280, -10250], [94480, -6584], [-76312, -4867], [90126, 7160], [-11640, 13029], [-82974, 2767], [-21012, -4356], [81380, 6464], [99292, -2650], [68898, 862], [5030, -3748], [94198, 2108], [195194, -1645], [-84566, 6766], [-54902, -1110], [-71564, -5449], [133610, -417], [-110324, 1871], [-44764, 1538], [-99346, -10252], [-34228, 14572], [98268, 3618], [-140116, -3781], [76680, 382], [76018, 10420], [-91076, 11591], [132042, -5613], [142362, 1006], [-112042, 8672], [111680, 1156], [23980, -3508], [-59646, -11682], [81120, 1836], [33762, 326], [140334, 3996], [-72168, -13536], [-144100, -6778], [-86308, 4316], [98190, 7748], [-9260, -6065], [48742, -14423], [81514, -12584], [-3676, 20022], [-25592, 11826], [11952, -13536], [-51532, -16793], [103222, -1415], [-62642, 15484], [122964, 7306], [-38792, -4696], [-15838, -10864], [-106582, -398], [137478, -9008], [6168, 11881], [15138, -16458], [-52970, -13719], [-54226, 12256], [-16328, 21978], [-28992, 19944], [15094, 3325], [10446, -5440], [138004, -4232], [43180, 9966], [-132110, -1704], [-53856, 21057], [50004, 9152], [-55856, 8562], [68440, -1988], [-45470, -21084], [-8190, 5447], [-161894, 7114], [-58216, -9494], [172168, 653], [-55318, -2342], [-58486, 5050], [28202, 17443], [138498, -4110], [68420, -3917], [8414, 15421], [43982, 9656], [3986, -3878], [42528, -12598], [82260, -10334], [155798, 2092], [78432, 19845], [1452, -19414], [165696, 950], [-119962, 1212], [-17740, -6249], [-14152, -9976], [257558, -2143], [151794, 9210], [-117564, 642], [-17256, 6109], [103162, 4262], [-107848, 15804], [20100, -7506], [192854, -860], [116932, -7993], [-123652, 8142], [-150978, 4836], [-4272, -4758], [-76284, -8106]]
