
# q-expansion of newform 650.4.a.m, downloaded from the LMFDB on 08 January 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 = 650
weight = 4
poly_data = [-26, -1, 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 = [[-2, 0], [4, -1], [0, 0], [3, -1], [-23, -5], [-13, 0], [35, -7], [20, -12], [-4, 17], [-95, -8], [93, -11], [310, 12], [116, -22], [20, -17], [145, -59], [-79, -28], [35, -7], [-137, 92], [391, -87], [100, 190], [798, -70], [-390, -83], [83, 149], [-750, -138], [-40, 178], [309, 96], [26, 319], [-268, 77], [-114, 184], [468, -255], [1426, -57], [312, 69], [502, -308], [1116, -377], [680, 290], [2117, 27], [2849, -161], [-548, 42], [332, -118], [-795, 183], [-1986, 357], [3005, -333], [-1902, 63], [732, 176], [-956, 178], [98, 441], [254, 210], [-4784, -78], [-1255, 641], [-2044, 420], [-4248, 525], [457, 301], [-1660, -894], [-840, 252], [967, -884], [-2870, 562], [1769, -136], [-2147, 1361], [-548, -651], [-1496, -944], [2778, -1090], [1608, -906], [6312, 326], [-5724, 927], [-4973, 300], [1504, 1222], [-756, -128], [1237, 1428], [-8872, -601], [2664, 1252], [-1242, -1590], [2011, 1135], [4564, -1113], [-1125, 1076], [-919, 975], [-3804, 1812], [-6664, -1003], [2930, 118], [-4584, 1872], [1826, -978], [656, -1249], [-10628, 968], [2788, 616], [-636, 2525], [592, 776], [2770, 1414], [-9474, 1026], [4390, -1974], [5512, -1154], [15237, -133], [-15204, 63], [6181, 343], [1399, -465], [-892, -2089], [11279, -1533], [6254, 2213], [-20152, 26], [-4892, -905], [-884, 228], [2056, 926], [8970, 1382], [-11568, 990], [10790, -1945], [-14235, -876], [10520, 1764], [7132, 2802], [-7403, 1051], [25394, -262], [-13188, -1899], [-5539, -192], [6526, 1326], [-3684, -64], [6958, -1748], [21072, 934], [-7036, -1848], [1195, 3796], [13468, 1428], [-8254, 2942], [-7135, 2807], [-18618, -1869], [-12242, -352], [-11769, -3787], [-2292, 4815], [-4777, 2339], [-13045, 2073], [4839, -5124], [4776, -2072], [25556, 1703], [-502, -3791], [1378, 6750], [11747, 759], [-2571, -945], [-12472, -1785], [12271, -159], [14644, -2954], [-9688, -3444], [-3056, -2540], [20561, -11], [-30739, 1796], [8526, -5868], [11527, -2215], [5336, -280], [26722, -3735], [-8885, -3851], [-4923, -6464], [39932, -274], [-8726, -258], [-52, -3655], [20290, 566], [5077, -4979], [-9662, -546], [-13607, 8272], [-18814, 313], [-2900, -836], [43762, 945], [-5630, -2987], [40652, 1140], [25734, -1362], [42301, -420], [-10074, -516], [-41785, -343], [-28587, 2751], [-3005, -3171], [42726, -1158], [-17378, 3832], [35215, 1789], [-19756, 3075], [-6575, 6444], [15498, -1556], [12291, -3708], [8336, 6398], [14516, -3174], [35714, 467], [12416, -1904], [-25720, -4203], [-16573, 2024], [-5049, 9613], [-15958, 3878], [-18080, 6207], [-26981, 629], [6748, 8682], [34484, 752], [-2946, 3584], [12244, 2182], [35553, 975], [49144, -239], [36397, 2220], [13321, -12411], [29590, 2432], [25029, 1875], [22686, -7768], [-22373, 7039], [18888, -7748], [52506, 3390], [23700, -4320], [-25335, 3147], [3046, 6422], [24365, 5956], [-22958, -3308], [-6548, -6560], [-34158, 7518], [3046, 278], [1832, 10630], [-67395, -548], [49677, 5163], [12408, 3135], [-30749, 1151], [2658, 5523], [-17112, -8016], [-94, -5034], [33973, 2511], [50034, -3384], [23002, 9270], [-10719, 15747], [35711, -10459], [50690, 582], [35550, 1415], [17749, -13637], [53251, 3253], [10754, 15566], [28260, -599], [6852, 5182], [14068, 8626], [-22355, 2775], [74926, -5687], [-27739, 15876], [57548, 6515], [-16672, -7384], [-13754, -16242], [65527, 5647], [-30424, 8875], [-42400, -9819], [-67975, 2919], [48550, -9392], [33722, -11738], [-72956, 634], [-3434, 5636], [56696, -7018], [39138, 4938], [-73960, 7409], [-50464, -682], [-12370, 8661], [69082, -2091], [23894, 1182], [70558, -2768], [12902, 11933], [-52512, -1474], [55288, 3034], [52957, 7007], [-38264, 3157], [-27344, -4914], [-17144, 3418], [-43892, 3766], [-44233, -12852], [-57320, -7727], [65095, -1589], [38120, 7359], [16867, -1233], [16913, 11324], [-9290, -11982], [25282, 15351], [45208, 4093], [17952, 4402], [29016, -14233], [-67032, -3444], [-57694, 546], [63632, 9122], [25728, -2988], [-44201, -3555], [60347, -3316], [20592, -12197], [-76911, -2695], [-72884, -1848], [74918, 963], [25731, -12304], [-39821, -13899], [84444, -8628], [-52624, 12936], [-5918, -18700], [-69734, 2779], [-5310, -7881], [-23476, -8778], [23542, -17306], [-11188, -9180], [-38909, -183], [-41372, -9581], [-77219, 16512], [-23026, -2176], [-45021, 295], [103753, 9340], [-39679, -6625], [-9848, 18772], [115046, -1708], [40021, -15719], [24891, 20192], [-42551, -11057], [-30526, 2154], [38586, -9636], [-13430, 13966], [70839, -14845], [-4405, -24944], [46282, -7826], [-127216, 10011], [-53066, -9317], [-50414, 3953], [17036, 24640], [65156, -10456], [6392, 26409], [-21500, 13780], [-58235, 16464], [55058, 12461], [109692, -6804], [-18179, 16420], [-34498, -15407], [-11981, -19037], [-50724, 6115], [-17543, -6137], [-62228, -9338], [-102808, -5882], [104947, 10576], [-66932, -20479], [-93368, -1932], [33218, 18908], [-4185, 16961], [101542, -11324], [-12681, 28204], [-17231, -22009], [-47975, -16869], [-34738, 5771], [161479, -788], [22220, 10458], [-162754, -5884], [-73300, -17151], [75461, -19693], [103189, -1603], [44279, 12851], [-22898, 26180], [11636, 26582], [95870, -6114], [22684, 20964], [39688, 11088], [-23258, -3224], [-25432, 7184], [33694, -26293], [106292, -22840], [72924, 10425], [-17531, 14972], [-62429, 23283], [55277, -10279], [-116263, -10276], [147925, 11387], [-114980, 18408], [-128546, -8414], [-35994, -658], [43832, 8703], [-39125, 40996], [-80917, -8035], [-45779, -23123], [-42681, 28308], [-53349, 16023], [-7094, -15252], [86670, -20460], [34522, -18179], [644, 5360], [64290, -30223], [-11664, -1183], [45510, 24102], [-5505, -31849], [42155, 19512], [163922, 13187], [-112670, 143], [167644, -13034], [3411, 15960], [81038, -8958], [-50789, 10125], [137183, -20245], [-218076, -132], [-86090, 31704], [96381, -21129], [204588, 6323], [73112, -148], [26264, 4580], [31945, -39423], [-75188, -8438], [12352, 14006], [-5088, -18384], [49997, -3837], [-239997, 4652], [42344, 2758], [195996, -1581], [-191038, 1134], [-39238, -4306], [-30117, -19239], [-87902, 1791], [-178489, 18323], [-17167, 12244], [11225, 26067], [10021, -5489], [16340, -10395], [-24870, -24378], [70766, -33060], [-83563, 5204], [-34951, 37921], [116620, 23380], [-32306, 2662], [-25162, -29469], [-136026, -12202], [48372, -7098], [-12653, -4857], [-6316, -17944], [-117235, -10649], [116749, 16936], [-18818, -37667], [32708, 34416], [-13378, 20836], [-192647, -13265], [152672, -19936], [-138342, 12245], [-49930, 41648], [-179460, 13575], [-19689, 15477], [-120862, -27818], [-223197, -5607], [3894, 9831], [2722, -23700], [-44182, -34150], [-36298, 51794], [-59778, 52206], [223185, -12839], [-232674, 12021]]
