
# q-expansion of newform 48.12.a.f, 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 = 48
weight = 12
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 = [[0], [243], [-5370], [27760], [-637836], [766214], [3084354], [19511404], [-15312360], [10751262], [50937400], [664740830], [898833450], [957947188], [1555741344], [3792417030], [-555306924], [4950420998], [-5292399284], [14831086248], [13971005210], [-3720542360], [-8768454036], [-25472769174], [-39092494846], [9310781526], [-48575052512], [-225595713276], [-69451179514], [-359664575694], [-250273055864], [97891780812], [-155014706262], [1126265370436], [-1384580812362], [698601450208], [2131269853958], [163564486972], [8809425240], [-730851575394], [-3923714421540], [2279308973150], [-3387088726656], [-4929207776254], [6357850272342], [3785535410272], [-179493837380], [-2225684379704], [415847834940], [18124772488334], [-18764059878], [17625242631984], [-890116982734], [24228041356548], [7804917351426], [-16595574775368], [28523590257006], [-23379994087976], [-30364120269058], [15974859435594], [-28704507156044], [48175396168278], [-25735029040676], [-34604265524376], [12606588910058], [-81824296913634], [34011469184548], [-59943948292558], [-97868505351324], [-142789606547098], [144245920772994], [124349284943496], [160109534089768], [-34725822875218], [146500203674500], [-64341851639808], [-39890033609466], [106551979242806], [34144491481698], [53334901088234], [101287654153404], [-157928472303826], [-513171359936640], [-74924767954222], [368335241090320], [111247830230916], [-88331413841262], [-9420937722310], [-697133548616898], [187941271733848], [-320006635626996], [150382370364240], [-176546273555504], [860958181676292], [-601209457412516], [-1092030351829704], [876371101334814], [-371989239852150], [973507481712628], [1746062781765590], [-174624425985380], [1583649005842494], [975797917848204], [1924274391870426], [-1611320399461196], [-2532503285394046], [3115075841122404], [-2207230435400238], [-3411585709398408], [-1575452477398774], [505592119502056], [-1983747166907074], [-1930986428345862], [-947688701475164], [-1005926522765312], [1131443807632530], [868305558659068], [1376364875369256], [2552758540391838], [-926792107209060], [-1903318977724498], [4929900506581730], [430293314013702], [3812440532297652], [-4037287750902356], [-4712672943685602], [866706096098606], [-26266614058368], [5680181884175392], [-1623115878038218], [-3647940323190644], [-6760448268703752], [-26483336560376], [7373643624794558], [6209832596186874], [-8861954082034942], [-2950474409673642], [-13554522166415156], [-15992249482082994], [9458590804847370], [10799627434960948], [-11041089876780186], [-12610352980858976], [786172343593716], [-5925892982962570], [-21020885793462840], [-19837829468018002], [7966388437568826], [15974892909578980], [4029257485765728], [9769575093688790], [16258292298256914], [-16606117429647572], [19131414356441544], [10725166653853684], [28224866626031568], [-18355082826013760], [-11012509124864814], [8363567050915322], [22294170304617630], [37803832630940892], [4795681030490394], [-33741958118885504], [-35858687142537900], [-12002334917621406], [4426868496055080], [37916708594080408], [57600280458878], [7035218914614770], [13683066346126326], [-20867877644988876], [-43321549659971482], [-61898855996524584], [-59456551648533862], [-26121771539998712], [40972592810939466], [-29050978742193740], [-73950101045550234], [-12851211568257632], [30770326113449270], [-4867276861531400], [-66250008587571396], [-46992779590122514], [-43718422033413414], [37173650350909488], [63283189582399830], [25131310316782454], [71766794335592236], [43501961665276442], [31575190205097216], [78153256556596802], [584867308546884], [29326799954985532], [-114725429284591794], [-124749906820108884], [44364383610990906], [-38701375524845614], [25280358000068246], [92946264072139266], [118510164885612312], [-80704789081784322], [-155137596983924648], [-189425889091716418], [-80404666215468574], [-194512569561303948], [36267602202286110], [147601141337531464], [-17983370202913668], [245216661611093178], [-189066286410006284], [149090803733447858], [-24634054221738], [-128663175680808080], [-22947146672884044], [199039501350243816], [8463690470903738], [-25357162960188728], [-226534485261064062], [350720195537631528], [-57480967603440978], [-37215526806612946], [53927729950346128], [218169256596366450], [380914090762375384], [335419764117401004], [71900245276829870], [280193116514043498], [63535374862583184], [281865445173238144], [-267789482952372924], [254329240197940550], [-54456755233215476], [-268673600398308056], [-187405619635787622], [-415049744220705356], [-302640903260506464], [-459073914578361838], [-142133133768388362], [-62210982507069756], [111331068305310792], [230876385326482764], [-368696070337116044], [-36748174434530768], [645797444078571158], [-216615264931402062], [-449669039276902344], [223622334716320888], [-576501882331083060], [-279213123169530044], [-440915544388523088], [26130638692028150], [-699551742161992158], [-90538933214884440], [-481549578192124006], [-184621303294521042], [630979763091050268], [233560259699929022], [-126809206771191404], [194852937743039862], [876370806945939242], [-812045213668716152], [299055303522626700], [-371241649241849458], [854647847257328966], [-123060392681316846], [685014984276002572], [-362759879734162434], [664563856092363978], [-166105057993741340], [-321635282269051194], [-1112347718563418506], [-155642185797887396], [-1122061776605762422], [-509412722850571112], [1007928184524089426], [-71968517875692848], [-483983942729063772], [464151471669900230], [-631889005114786534], [-623432360264613540], [619213031856076560], [285228416860651936], [859932402046570200], [897173543059521566], [-717291166408466156], [-161133481125336240], [1219101007190464658], [357365189670860118], [-1868170331611036832], [1286527030720736130], [-807836208443388354], [1636639912799383644], [1870216084915228938], [1813863775239094596], [-1851809960115681322], [981408548734770990], [2082672779361104488], [1720703724609572934], [-612994190716256220], [-1572627238676851748], [510281865590253146], [120453934861278], [-15192882075744632], [-890730891203861316], [677529054481947652], [-593243114021244286], [-1520060577011916396], [1589562447562958246], [69971709179496984], [1860853308387437342], [-134853070780172112], [-1426832561006316954], [-720171956971750350], [432876052703726812], [221064294312858744], [-2761918686836314054], [-2812980248190936132], [1829226412520424528], [-1550889483928340350], [-1964252535605949678], [-1457452719826739780], [-3080081533851666550], [-2441687998652935074], [162290519201227768], [-1124564690107172118], [-2941966959933316174], [1228749955233837820], [1591134529495886212], [1814500159041446112], [4239858752715888486], [3762437926461675782], [-2425319243974409586], [3234177293591528680], [-140151952575007764], [-238936035732896828], [-32764594960319868], [-1294049121957741562], [-1251988642476310974], [1153428863684137658], [-1953959796094914344], [-5079435715408269298], [1174119799525195290], [3471572618165179254], [653932658656941088], [3287974529946603966], [-2067288790032226980], [1580714990270326478], [5889941608844545348], [3258492283761670560], [2441047836708018342], [-3585646333015498916], [-6631429266836880838], [-4059348713022707250], [-4613335128978493064], [-4988294911703665234], [2273623873498051146], [6049895375043677184], [-3283436125656096444], [-3360155163277965918], [-3714403848276287256], [-2203788239432237506], [5760823127043089274], [-2927511105787413072], [5202701106207670596], [-4180611401373403316], [3132797379588730490], [-6683114760508033266], [-5113200035210844656], [3228162282877252106], [-1323844645625851524], [-9359349974945579756], [6460049525503315920], [2710417144331600646], [8110065773214896896], [3630956106089678870], [-8153377180322153556], [6304326448519379232], [-4948624225973923486], [-3924698535405340542], [-4465293981413555254], [-7907445325225780338], [8155850330320705002], [-10682375842877588192], [-3919789660791249246], [4588826428695804508], [8502787672725203928], [939395724091248136], [9362180583347524766], [-717452170483577132], [-3671876128256864976], [5757292136871561794], [-534375151926608154], [-2258678401923775932], [-4116845892096177620], [-9871593505575901368], [-1943940422796578902], [-499507381328478680], [3848447736693211434], [15140856358861714900], [-1827016601541499626], [-5630777033064670522], [-12644755342370430606], [-1811154401922382280], [-3620513072172553350], [3434452585385782806], [6252381255078271600], [4399176367863243014], [-14857306465435362174], [-5424066481289070068], [-4373078750563583364], [-4217610023906544526], [17464418679207309846], [-6092328969411307740], [3992189947850532604], [6715645306316154746], [-8537397336078716466], [-8506088532993142656], [10003457796462437584], [352731723000101730], [-3807561697580393544], [-9605809694571481362], [-1155880902462658018], [-15408566150204655312], [17410405260649145316], [-16802974031724281446], [-12082689563400779154], [13064328531515147340], [14414036895378228330], [-5290193597767838876], [-567534879035334024]]
