
// Make newform 1856.4.a.bg in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1856_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_1856_4_a_bg();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_1856_4_a_bg();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [396802, 439999, 30654, -85158, -10822, 5872, 394, -138, -4, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [369231982, 180274991, -97616725, -33394123, 9556105, 1175057, -264339, -11757, 2129], [-860902, -4511931, 248575, 1014083, -127235, -34357, 4409, 317, -39], [78704822, 46817579, -16395629, -7355187, 1598859, 235173, -43679, -2165, 347], [-787744538, -336420739, 176498495, 55607237, -15686240, -1812133, 412971, 17103, -3196], [-1519251202, -954029561, 342770455, 163032163, -37053595, -5309147, 1041729, 49617, -8339], [259520594, 132639157, -67067285, -22288601, 6418745, 734299, -171603, -6999, 1333], [2604377566, 1365624923, -594191305, -221542279, 55355365, 7151861, -1481127, -66681, 11597]];
    Rf_basisdens := [1, 1, 4740120, 83160, 316008, 2370060, 4740120, 677160, 4740120];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_1856_a();"
function MakeCharacter_1856_a()
    N := 1856;
    order := 1;
    char_gens := [639, 581, 321];
    v := [1, 1, 1];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

function MakeCharacter_1856_a_Hecke(Kf)
    return MakeCharacter_1856_a();
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..(prec+1)]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 4;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0], [-1, -1, 0, 0, 1, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, -1, 0, 0], [7, 0, 1, 0, -1, 1, 0, 0, 0], [-6, -1, -1, -1, -1, -1, -1, 0, 0], [-9, -1, 1, -1, 2, -2, 3, 1, -2], [5, 1, -2, 1, -3, 0, 1, 1, 1], [-4, -3, 3, -1, 4, -2, 3, 0, 2], [29, 0, 0, 0, 0, 0, 0, 0, 0], [4, 4, -6, 0, 6, 1, 4, -1, 3], [11, -3, 3, 1, -8, 0, 0, -2, 2], [-48, 14, 0, 8, -6, 0, -1, 1, 0], [3, -26, 2, 1, 3, -8, 7, 5, -5], [-122, -20, -12, -1, -1, 0, 4, 5, -1], [-18, -1, -2, -8, -21, 2, -4, -7, 1], [76, -45, 4, 16, 16, 1, 2, 5, -7], [-113, -39, 0, 4, 12, -11, 20, 12, -3], [153, -53, 17, -5, -2, 6, -2, -14, -12], [-196, -14, -12, -20, -28, -4, -12, 0, -4], [-87, -9, -21, -3, 4, 14, -4, 18, 0], [-304, -48, 21, 10, -11, 1, -3, -10, -10], [333, -50, 3, 17, 6, 25, -10, -7, 11], [-44, 4, -18, -6, -2, 20, 7, -9, 2], [-229, -91, 11, 13, 4, 4, 15, 15, -10], [-128, 66, 48, 12, -62, 36, -60, -8, 12], [-303, -59, 27, 19, -12, 30, -32, -12, 10], [313, -26, -57, -39, 30, -25, -10, 31, 13], [-227, 27, -19, -1, 31, 11, -7, -9, -17], [-278, -58, 0, 24, -36, 6, -2, -24, -12], [-526, -52, 1, -44, 65, -18, 33, 9, 7], [411, -43, -5, 18, -23, -19, -14, -24, -22], [-247, -19, -27, 23, 0, 6, 18, -2, 62], [485, 62, 35, 39, -4, -29, -6, -31, -25], [-428, 113, 0, -42, -19, -32, 22, 11, 47], [-317, -34, 14, -10, 36, 20, -11, -36, 28], [-469, 113, -26, 18, 130, -31, 34, 18, 1], [806, 131, -62, -16, -66, 16, 12, -10, 30], [-829, -47, -49, 79, -8, 42, -46, -20, -42], [-250, 168, -46, -34, 16, -30, -24, -20, 50], [392, -58, -58, -86, 40, -94, 66, 26, -14], [-781, 17, 38, -34, 39, 10, 24, -26, -56], [-516, 250, -30, -21, 3, -17, 10, -58, -6], [-53, 71, 63, 21, -72, 34, -51, -29, 58], [-934, -24, -46, 86, -88, 74, -70, -14, -54], [-645, -84, -42, -58, 104, -98, 65, 30, -54], [376, 17, 99, 91, -124, 73, 49, -21, 5], [-373, 35, 65, 59, 94, -56, 140, 36, -110], [1209, 131, -7, -25, 210, -20, 66, -36, 54], [-1068, 88, 77, 67, -160, 9, -12, -24, 57], [-204, 195, 150, 48, -99, 124, -143, -66, 57], [-326, 189, 125, -1, -46, -14, 19, 30, -24], [-936, 175, -45, 107, -75, 29, 8, -27, 0], [-4, 137, 37, 17, 136, 97, -37, 7, 17], [-756, -94, 18, 34, -147, 93, 66, 100, 3], [-608, -84, -17, -101, -104, -84, -1, -42, -112], [-920, -168, -135, -45, -102, -41, -90, 110, 27], [942, 480, -141, -123, -138, 32, -63, 40, -30], [-850, 376, 66, -2, -64, 98, -130, -98, 50], [-1534, -21, 1, -111, 7, -99, 232, -17, -110], [-146, 305, -100, 40, 36, 163, 76, 59, 59], [-1810, -174, 70, 10, 16, -76, 250, 36, -118], [-1387, 64, -116, 73, -159, 14, -89, -99, -129], [-148, -214, 24, -7, 155, -195, 32, 52, -88], [-2050, 298, -47, 183, 3, 46, -89, 27, 76], [196, 220, 175, -47, -30, 65, -84, 68, 61], [-2252, 151, 35, 79, 232, -189, 245, 101, -61], [-501, -419, 305, 171, -146, 188, -175, -155, -150], [-746, 596, 112, 24, -484, 50, -226, -26, 2], [-1026, 83, -21, 131, 317, -91, 345, -86, -62], [642, 452, -149, -171, -290, 109, -219, -15, 143], [342, 48, -81, -70, 187, -83, -115, -36, 0], [1364, 224, 64, -27, 151, -237, -52, -114, -238], [-1271, 37, -235, 11, 109, 127, 165, 61, 57], [-1119, 465, 228, -37, -47, 166, 107, -197, -21], [314, 5, 25, -29, 394, -240, 255, 32, -102], [-2413, 631, 37, -169, -260, -36, -178, -26, -156], [-461, 1149, -16, -148, -193, -152, -308, -30, 42], [-1436, -393, -93, 11, 91, -357, 0, 61, -162], [-3510, -740, 14, -162, 360, -366, -50, 66, -42], [-2489, -419, -137, 319, 568, -54, 26, 104, 22], [-3242, -212, 101, 79, -22, 11, -152, 138, -131], [427, 366, 182, 68, -142, -232, -263, -30, -34], [-965, -871, 31, -167, 504, -280, 298, 20, -62], [3800, -69, 39, -93, -112, 104, 207, 226, 304], [83, 513, -110, -101, -337, 46, 215, 165, -7], [-117, -1247, -83, 95, 82, 104, 302, 144, 6], [-1804, -882, -299, 11, 162, 157, -187, -27, 63], [805, 481, -227, -265, -170, -208, 104, 112, -204], [4962, 449, -145, -179, -62, 44, -359, 40, 274], [55, -822, 134, -119, -273, 84, 19, 81, 99], [-636, 456, -434, -102, 52, 157, 152, -71, 93], [4302, 335, 17, 23, -822, 318, 115, 94, 204], [2149, 106, 116, 37, 285, 402, -345, -43, 183], [-3564, -1385, -38, -108, 298, -139, 272, 115, -21], [-766, 102, 222, 426, -1044, 355, -182, -73, -157], [1866, 593, -157, 87, 157, 15, -15, 84, 226], [-1254, -400, 569, 131, 313, -130, 551, 1, -218], [-2516, 162, -284, -58, -34, -272, 156, -50, 118], [-9, 147, 173, -77, 144, -196, -432, 12, -344], [-104, 45, 156, 46, 346, 83, -130, -39, 381], [4156, -158, -87, 183, 22, 145, 427, -153, -137], [5668, 191, -105, -117, 40, 75, -23, -339, 171], [-2741, 949, -307, 19, -62, -68, -152, 210, -38], [-1376, -78, 8, 8, 748, 154, -8, -114, -6], [3120, -132, 210, -130, -392, -86, -67, -167, 88], [4721, 76, 289, 57, -24, 331, 232, -195, -33], [4972, 156, 257, 95, -55, 318, -781, -17, 272], [-3770, -136, -116, -107, 373, -112, 144, -185, -123], [-1926, 1226, -112, 12, -262, 208, -379, 61, 182], [-2746, 274, -18, -478, -196, -553, 114, 119, -521], [-935, -657, -179, -97, -401, 47, 527, 73, 315], [-295, 1361, -231, 539, -280, -98, 150, 110, -150], [-182, -119, -77, -227, 1414, -113, 147, -57, 85], [-1647, -455, 113, -177, -114, -374, 478, 138, -196], [4011, -649, -189, 105, 542, -252, -439, -53, -216], [-1124, 51, -438, 0, 778, -181, 340, 445, -255], [-6008, -183, -283, -247, -160, -64, -343, -54, 36], [8096, -694, -75, 95, -924, 323, -52, 182, 253], [4172, 719, -308, -464, -396, -206, 240, 154, -154], [-40, -1946, 193, 87, 458, 9, -53, -37, 187], [3660, 1149, 822, -36, 119, 372, -621, 2, 287], [2138, 486, -340, -128, 316, 82, 216, 322, 48], [8708, 1468, 90, 48, -1174, -156, -514, -162, -174], [-655, -2297, -45, 9, 422, -112, -568, 336, 18], [7784, -1113, 322, 320, -199, -104, -198, -179, 33], [-3556, -1261, 161, 33, -1, 217, 473, -148, -44], [-8455, 657, 781, 331, -1134, 82, -178, -66, -36], [-2178, -148, 290, 123, -637, 377, 548, 92, -292], [1384, -1534, -644, -120, 198, -604, 26, -238, -388], [5042, 2179, -214, -290, -764, -180, -292, -452, -152], [-8602, 1106, 420, -349, -275, 195, -294, 280, 136], [-3100, -208, -444, -677, -371, 85, -516, 242, 178], [-2702, 1016, 159, -35, 1170, -263, 148, -222, -345], [2784, -1538, 517, -373, -1386, 345, -143, -451, 87], [4952, 1954, -426, 386, -408, 232, -153, -259, -244], [2911, 3567, -16, -532, -550, -411, -180, 174, 39], [3459, 427, 525, 219, 438, 584, -296, -232, 94], [3559, 1437, -26, -66, 864, -421, -190, 62, -1021], [2889, 1675, -513, -539, -1304, -230, -88, 66, 108], [-4087, 46, -103, -183, -408, 31, -920, 385, 387], [-1970, -3025, -322, 168, 213, 476, -180, 253, 19], [-5372, 490, -183, -20, 73, 780, -829, -85, 277], [14374, -49, 241, 383, 578, 131, 513, 47, -307], [1565, -2799, 156, 208, -612, -491, 90, 280, -473], [-14950, 3888, 65, 236, -1853, 325, -1101, -8, 224], [-1161, 1941, 291, -71, 766, 222, 512, 30, 168], [-1690, -3798, -690, -438, 541, -331, 376, 588, 705], [1043, -296, 446, -223, 1415, 100, -233, 337, -405], [-15109, -1339, 1119, 533, -858, 264, 610, -404, -302], [7674, 3403, 480, 478, -57, 260, 306, 39, -277], [11550, -1304, 408, 676, -340, 44, -82, -178, -4], [-6683, -1314, -185, -383, 2514, -493, 146, -77, -163], [-17496, 2506, 135, 697, 366, -132, -177, -284, 158], [263, 221, -176, -59, -885, -172, 673, -41, -469], [-5524, 1594, 399, 9, 198, 198, 487, -338, -536], [-690, 2250, -132, 172, -984, -88, -538, -436, -700], [8408, -1910, -710, -778, 1944, -828, 460, 208, 236], [-4070, 1804, -571, -973, 198, -889, 165, 365, 453], [11159, 2649, -773, -271, -197, 499, -207, -337, 315], [2623, -260, -582, -219, 831, -782, 1127, -77, -199], [-3012, 2865, -818, 572, -1571, 1030, -715, 280, 137], [6760, 4118, 466, -619, -1281, -192, -108, 73, -49], [5619, -2419, 44, 331, -175, -218, 409, 575, 163], [15340, -1016, -1, 417, -913, 310, -447, -507, 80], [-12086, 844, 754, 239, -39, -460, 978, -213, 357], [1274, -482, -112, 898, 214, 738, -246, 376, 104], [-6142, 3602, 424, 464, -1030, 368, 378, -328, -854], [4162, 4530, 523, -43, 467, -200, 347, 407, -34], [-3727, 17, 621, 255, 1220, 398, -730, -790, 738], [2966, 809, -706, -464, -82, 397, 350, 635, 367], [6369, -2139, -307, -437, 1395, 293, 83, 131, 1107], [-6949, 849, -331, 577, 2128, -532, -500, 70, 208], [-4157, 3073, -421, -1023, 1626, -914, 102, -252, 528], [-5925, -1096, -226, 1250, -1016, 700, -1331, -208, -872], [-12346, 1908, 119, 393, 2686, -687, 1001, 121, -729], [-22590, -28, 336, -358, -98, -602, 354, 156, -580], [-5261, -2607, -954, -274, -796, -1357, 306, -298, -173], [8152, -456, -165, 212, 369, -13, 1059, 1300, 76], [5620, -4058, -502, -1066, 524, 620, 762, 22, 104], [5698, -1290, -129, -932, 141, -403, 21, -150, 954], [6140, 2201, -272, 218, 1714, -508, 400, -102, -362], [-11712, -62, 431, 529, -3346, 471, -1107, -27, -211], [5440, -834, 1107, -119, 695, 116, -161, -967, -720], [-153, -75, 691, -659, 202, 1010, -1350, -842, 676], [-10891, 1083, -1035, -1537, 781, -1071, -347, 1199, -267], [5409, -419, 1322, -822, -340, -417, -412, -182, 373], [-17937, 2107, 1112, 507, -299, 200, -703, 65, -71], [-8593, 2271, 859, 633, 2026, 648, -669, -59, 32], [-1434, 137, -1029, -687, -1326, -1066, -447, 710, -240], [1488, 527, -1553, -433, 745, -619, 2096, 1197, 788], [-5282, -4109, 741, -927, -392, -437, -103, -375, -165], [-9089, -2562, -1240, -115, -2391, 300, -1867, 399, -563], [8116, -2872, 978, -58, 434, -176, 40, -294, 530], [12839, 2647, -192, -867, 1691, -1638, 217, 521, -911], [-1922, 3764, 773, 987, -214, -541, 1299, -705, -47], [3003, -897, -1075, -93, -1824, 664, -1446, -146, 580], [3528, -3906, -536, 1000, 1040, 654, 240, -368, 618], [3306, 2631, 293, 661, 1737, -1041, -680, 367, -460], [-10319, -351, 201, -407, 156, -474, 718, -400, -878], [-3098, -664, 131, -419, -236, -441, -48, 1174, -911], [24750, 517, 639, -273, -196, -254, -659, -84, -294], [-8707, 6521, 154, -218, -478, -527, 890, 24, -609], [-15471, 1401, 551, 933, 204, -264, -1055, 59, -772], [20491, 3055, -890, -545, -105, 1124, -497, -205, 887], [5123, 1397, -753, -251, 1985, -399, -35, 359, -611], [21526, -1960, 362, 545, -293, 1156, -1970, 293, 495], [-15342, 2496, -340, 858, -1570, 1292, -1526, -10, 482], [-12656, 1378, -2162, 86, 1771, -137, 636, 874, 749], [-6033, -1968, -261, -670, 735, 209, 1542, 568, 1048], [-64, 1128, 2442, 898, -1054, 752, 641, 101, -566], [-1706, -2532, 940, 948, -1216, 584, -164, -1048, 344], [6878, -630, -464, -484, -300, 1197, -180, 1333, 725], [859, -2444, -493, 1980, 57, -103, 894, -234, 26], [-17714, -4028, -408, 1137, 971, -25, 6, 918, -358], [-12958, -4380, -750, 306, 1413, 991, -1504, -254, 281], [-9420, -4048, -1250, 322, 132, 742, 338, 266, 918], [-49, -1813, -1433, -415, -52, 730, -1994, -1178, 378], [575, 1113, -81, -117, -2704, -1192, -754, 242, -136], [4445, -91, -2299, -1209, -206, 64, 122, -278, -848], [-14820, -824, 1191, -375, -2490, 769, -772, -968, 1233], [34069, 3458, 1746, -596, -398, -342, 363, -632, 24], [-4496, 6890, 1802, 690, -1584, 148, 796, 244, -1352], [20438, -106, -880, -1663, -843, -762, 276, -247, 1211], [21760, -5234, 344, 2120, 208, 362, 780, -102, -246], [-25794, -4046, -1022, 722, -2328, 208, 1404, 314, 722], [-11250, -4080, 644, -860, -146, -398, -518, -258, 1626], [-21352, 2950, -86, 801, -523, 397, -722, -386, 506], [-18308, -3974, -2476, -1009, 3103, -1090, 2478, 1659, 165], [-6206, -757, 2076, -62, -378, -179, -716, 63, 1243], [-17372, 986, -302, -38, 1386, -178, -2856, 372, -434], [-7374, -1980, 1460, -350, -786, -202, -1542, 20, 1704], [36072, -2976, 1400, -695, 1955, -1093, 144, 986, -1098], [6127, 1565, 639, -299, -128, 812, -1358, -700, 1666], [-12348, 3612, -38, 1624, -2782, 934, -174, -1656, 612], [-13882, 924, 625, 270, 1839, -660, 2073, 889, -1125], [-7294, 2974, -2618, -1046, -1560, -336, 535, 1023, 2142], [-17219, 415, 638, -954, 1726, 147, 1846, 458, 827], [6244, 5797, 1020, 460, -1896, 349, -2626, -543, -591], [14140, 14, 505, 857, -4324, 60, -227, -970, 1044], [32029, -1660, -344, -921, -5405, 1246, -2325, -417, 1265], [-22369, 2459, -789, -639, -2638, 118, 1082, 302, 460], [10113, -341, 2091, 1917, 2, 1882, 352, -1974, 640], [-14151, 4523, -477, -35, -248, 470, -476, -1694, -300], [4720, -4082, 991, 721, 5234, -169, 2065, -27, 685], [-35618, -5242, 566, -1256, 982, 348, 964, 570, -50], [-10013, 2946, 1020, 428, 916, -288, -1213, 180, 496], [5913, 6932, 25, -785, -1294, -1283, -160, -759, -877], [-9266, 3242, 3790, 1488, -3946, 1584, 236, -10, -598], [-15180, 8630, -699, 746, -1899, 419, -527, 732, 1160], [-16929, -1437, -1700, -324, -1152, 883, -764, 406, 505], [-15616, -3930, 2126, 1630, 4315, 523, 810, 312, -463], [-36988, 94, -1971, -47, 2968, 86, 461, -420, -638], [-20304, -1758, -522, -418, 2634, 410, -1450, -1634, -262], [-5281, 481, 1790, 1794, -654, -575, -272, -976, -91], [45759, -2801, -403, 437, 544, -352, 2508, 98, 1244], [-23482, 6104, -565, 229, -4600, 707, -2452, 50, 245], [-2612, 1455, -751, -93, -1146, -295, -557, 41, 279], [-8746, -436, 1734, 1290, 5408, 290, -88, 316, 102], [-30730, -1103, 594, -132, -981, 1108, 1759, -624, -655], [-4646, -340, 1044, 2375, 1889, 329, -938, -698, 66], [37879, 72, -1880, -2173, -1521, -664, 117, 489, 423], [-19306, 7080, 1672, 2328, 1048, 1160, -926, -1702, 1112], [-33653, -611, -1172, -1084, -1472, -2239, -1208, -8, -387], [2852, -4628, 662, 1226, 2292, -1422, -1537, 387, -380], [19245, 5566, 1385, 962, -359, 1573, -430, -358, -2026], [2431, -1121, 1335, -3495, 76, 182, -30, 186, 1378], [-7587, 5567, 29, -833, 166, -238, -2779, -759, 1040], [18215, 1393, 2158, 1211, 1523, 1414, 2663, -23, -3], [5911, -367, -1439, -149, 5671, -531, 1295, 573, 1729], [-18606, 577, 660, -1858, 3995, -34, -514, -1015, -257], [-10964, -1648, 2092, -294, -1010, -384, 388, -126, 1070], [-38512, -4529, 1896, -594, 3267, 1888, 227, -444, -223], [33768, 7514, 205, -340, -315, 2452, -2677, -217, 1105], [-25847, 2181, -283, -325, -416, -106, -1240, 1664, 362], [-9476, -2976, -615, -1705, -4542, 100, -839, -1672, -86], [38431, 6199, 1926, -513, -929, -1628, -593, -697, -1673], [-23163, 521, -1791, -329, 1597, 151, 3519, 811, -531], [-2256, -1912, -1412, -1376, 6130, -2046, 3996, 730, 52], [-27417, -2294, -1595, 389, -2260, 1605, -470, 147, 57], [-24671, -579, 1499, -399, 1202, 2376, -1484, -628, 678], [40008, -3618, 1808, -292, 2648, -404, 552, -120, 1036], [-38207, -2147, 3347, 1155, 2672, 1700, -1508, -190, 684], [-5450, -7896, 521, -625, 2126, 159, 1181, -115, 2213], [52791, -1091, -3035, -3102, 3243, -2159, 1808, 758, 760], [-14260, 1484, 600, 843, -2623, 1741, 1424, 1382, 110], [-18590, 7304, 62, -206, -2380, -1878, 2035, 597, -166], [440, -7894, 1839, 1417, -1776, 657, 1870, 360, -869], [-10051, 998, -422, 824, -602, 1314, -257, 552, 2400], [-10486, -4121, 1217, -1375, 5957, -1425, 3654, 449, -776], [-839, 3295, -3854, -782, 2567, -244, 1156, 2458, 198], [69506, -9101, -354, 1168, 762, 993, -2518, 143, 207], [-7034, 13171, -91, -107, -2639, 1603, -3978, -1215, 848], [32812, 8913, 1524, -822, 582, -658, -584, 984, 700], [-451, 9205, 2943, 381, -2422, 1554, -1386, -1846, 38], [-18102, -6407, 3110, 1524, 1825, 286, -1206, -579, -589], [22668, 8958, -3191, -942, -4599, 477, -2799, -110, 54], [-10782, -3807, -2132, -34, 943, -2294, -3166, 789, -613], [-32313, 4536, -401, 33, -234, -319, -2252, -1811, -661], [61087, -4379, -1914, -329, 5687, -1418, 1115, 1833, -727], [-11265, -5975, -1695, -585, 4642, -3244, 4413, 1497, -2090], [26548, -466, -3403, -1165, -1630, -1819, 59, 743, 971], [-66250, 4160, -478, 389, 4617, -1717, 2032, 568, -1188], [21065, -2842, -1583, -1656, -3617, 1623, -938, -650, 2678], [-31147, 7111, 2178, -157, -3113, 1620, -875, -221, -385], [-23876, 2474, -1793, 1853, 139, 288, -239, -1785, 412], [57596, -7995, 453, 119, 2822, -1951, 87, 329, -2033], [-20576, -4309, -911, -1519, 155, 549, 305, 824, 1804], [22590, -3795, -1501, -373, -560, 1508, -4287, -254, 3292], [7661, -3225, -581, -1695, -703, 1111, -2277, -879, -649], [-1797, -7410, -1088, 1794, 4362, -818, 1755, 1220, -1976], [9609, -1799, 2112, 1128, 254, 491, 64, -134, -871], [28452, 2530, -187, -2029, 3046, 549, 859, -777, 559], [37676, -18455, 1132, 1834, -2278, -1303, 1686, 1179, -1293], [27350, -7493, -2391, -1087, -1040, -920, 203, -1402, -1420], [26442, 667, -955, -891, -5609, 393, 308, -309, 1194], [83973, -8129, 1850, -295, 2257, 318, -427, -713, -1589], [13164, -4380, 588, -1736, 6500, -1738, -1128, -290, 1494], [-18944, -384, 577, -2825, 375, -640, -1313, 823, -1166], [15799, -7521, 235, -1471, 2218, 1176, 3243, 1357, 1352], [13482, -19169, 764, 1178, 3318, 960, 1518, -1322, -658], [-9616, 470, 1116, -1128, -1947, 179, 1932, -1506, -91], [33170, 6160, -1442, 2378, -4452, 4474, -2994, 206, 1750], [-42918, -6506, -2209, 1315, 240, 504, -751, 1578, 1780], [30590, -10317, 197, -2299, -1561, -3287, 1788, 1383, -1810], [-4630, -6290, -2538, -986, -3598, -582, -1905, -341, -1872], [-32108, -1660, 1584, -1942, 4838, -3808, 2848, 478, -442], [-50643, -12887, -2805, -61, 5076, 1052, 416, 482, 940], [28184, -5266, 3209, 280, -4369, -123, -1515, -1088, -588], [2875, 2369, 833, 2411, 163, -719, -1863, -1601, 513], [9651, 1163, 1515, -1747, -1688, 2626, 1806, -922, 1518], [31054, 5907, 1353, -1827, 695, -1403, 1219, -1216, -1806], [-26573, 5559, 1739, 443, -964, 2682, -146, -612, 3074], [-8419, 7355, -973, -326, -6455, -2253, 188, -1334, -424], [22037, 3032, -546, 1623, -1011, 2614, 1125, 137, 227], [60454, 9196, -2090, -658, 2616, 1274, -1884, 1202, 1710], [-21122, 2864, 4798, 2370, -5380, 2170, 570, 782, -1314], [-19501, -8677, -2313, -2575, 1622, -1356, -878, 738, 36], [20402, -8450, -1550, 1674, 660, -1456, 4038, 2620, -2242], [-7420, -458, 40, -582, 590, -608, 3212, -374, 2818], [-21880, -3078, 581, -3129, 4126, -6763, 5550, 1712, -4117], [13028, 6162, -127, 439, -9550, 1045, -1423, -1863, 1243], [-635, 1075, -4164, 716, 3792, -161, 444, 528, 1959], [45421, -1525, -3189, 205, 1354, -860, 1512, -1780, -1750], [-25230, -5580, 1108, -884, -5228, 1116, -3966, -354, -452], [-38929, 3334, 2213, 712, 43, 2687, 2952, -1462, 1586], [6928, 6386, -589, -1491, -1146, -3029, -1352, 1050, -2319], [39731, 4037, -2985, -466, -1903, -119, -2, 364, 350], [15222, -10262, -2791, -1208, 7655, -3395, 2015, -1060, -1852], [34873, 7067, 4655, 2789, -1994, 4144, -1620, -2426, -778], [18571, -10292, -231, -3001, -4430, 417, -1482, -559, 2091], [48344, -5466, -865, 1273, 6046, -557, 3183, 2259, 357], [6596, -2344, 3710, 702, -2224, -1686, 3508, 1690, -180], [-24797, 9090, 146, -2074, -2540, 274, 73, 1370, -2122], [-12452, -2638, -291, 2259, -978, -363, -1740, 78, -1757], [21198, 5852, -2242, 590, 4024, -3030, 1919, -1735, -1418], [69512, -3152, -2039, 4079, 2202, -1436, 3825, 1668, -3166], [-91804, -3015, -764, -174, 9290, -641, 2654, -243, -1571], [30070, -530, 1184, 1184, -996, -2170, 441, 1405, -2380], [20015, 8511, 2203, -2819, -5050, 1026, -918, -2026, 248], [47663, -4609, 2037, 1787, -1723, 3121, -1511, -2363, 1267], [51180, -7375, 804, -778, 2707, -1766, 1601, -1332, -2859], [-64534, 3550, -1723, -2094, -8731, 331, -1725, -1024, 1208], [-27777, 6987, 1777, 2289, -7444, 1590, -2652, -664, -738], [647, -5660, -2429, 1826, 1639, 163, -2730, 454, 778], [43702, 2040, 2856, -384, -3310, 2658, -3121, -939, 2014], [29870, -8898, 1462, -1654, 4010, -3286, -878, -676, -1832], [25558, -21052, 1944, 1050, -2306, -880, 666, 102, 1046], [-34313, 249, 4471, -103, 1538, 2266, 180, -1286, -812], [-42072, 15, 2369, 1007, -1798, 4091, -957, -1833, 5069], [-1824, 8530, -2658, -1450, 5744, -3394, -1326, -534, 2030], [29308, -16317, 231, 3411, 5448, -1026, -2997, 564, -1030], [-19388, 2622, -1638, -2010, -1992, -5392, 108, -488, -1668], [118456, -7715, -1271, -1621, -938, -2802, 4549, 1658, -784], [2937, -1565, -4250, -4018, -19, -2790, -734, 764, -372], [9521, 13675, -374, 1735, -4389, 524, 1789, 2355, -629], [85782, 4388, -3197, -1765, 4852, -2974, 1505, -1052, 666], [-21089, 4025, 1919, 2197, -102, 2146, -1103, -1319, 2388], [22800, -98, -5423, -3085, 105, -1812, 4127, -271, -336], [26934, 10062, -4523, -1293, 5079, 226, -2473, 1431, -756], [23072, 1660, 3568, 1084, -3442, 3398, -3218, -3808, -1008], [88930, 580, -345, 869, -1821, -254, 1611, -847, 738], [-8272, 6602, -1609, 2324, -7643, -4629, 1115, 788, -512], [37266, 6786, 2704, 1772, -2420, 4578, -1679, 1517, 2356], [-4157, 734, -6945, 525, 3258, 303, 4356, 367, -2739], [-25337, -14248, -1502, -116, 1354, 3664, 4697, 1326, 2198], [81344, -10826, 1296, 789, -9569, 3565, -6596, -3304, 28], [17200, 1099, -6080, -4974, -1539, 206, -708, 2163, 939], [36474, -6521, 4806, -1254, 5212, -1830, 2632, -2522, 182], [34444, 5720, -3064, 389, 4159, 695, -5880, 902, 734], [-66720, 1440, -768, -656, -3392, -1540, -68, -378, 1958], [27136, 2237, 5469, 1793, -243, 57, -887, -1274, -2034], [-34108, -595, -4538, -294, 692, 486, -1678, -1398, 1826], [-12939, -688, -621, 888, 2877, -4653, 700, -324, -2608], [46438, -24576, -744, -1072, 6160, -1931, 4736, 149, -1751], [-24794, -4684, 1371, -663, 4363, 278, -467, -885, 786], [-91848, -3392, -2680, -3402, 1742, -2930, 292, -556, 936], [55929, 1189, 5309, 195, -940, -366, 20, -500, -1434], [-63673, 7143, 1509, -2073, -486, 184, -2460, 2124, -2214], [75527, -1683, 3579, -391, 1934, 638, -3336, 14, -2968], [-16100, 7634, 378, 1598, -356, 3360, -4698, 250, 3120], [-68796, 1364, -3744, 1476, 2636, -3148, 4636, 2678, -566], [-39762, 8446, -630, 2789, -535, 6193, -4520, 1114, 1626], [41396, -2635, -5094, 856, 9075, -1052, -1245, 3186, -301], [61282, 495, 2528, 4430, -2931, 6550, -5160, -631, -375], [139075, -12924, 824, -680, 3092, -786, 259, 2066, -1034], [-45855, -11255, 5511, 5313, 3087, 3079, 1257, -2635, -1043], [17921, 1849, -385, 2993, -8778, 5146, -1375, -89, -1506], [-79135, 3794, -6123, -4096, -3101, 123, -3830, 1510, 1398], [5496, -2210, -3228, -710, -2322, 2040, -6744, -382, 62], [-37722, -5304, 133, 251, 9326, 995, 5925, 565, 877], [100530, -3113, 855, 1543, -7379, 1309, 1463, -1268, 1750], [-55829, -6518, -2239, 1333, 3080, -261, 1354, 1209, -1801], [-93910, -14197, -2268, -4304, -612, -811, -904, -751, 433], [98348, -13644, 4478, 4302, 5338, 456, 4157, 953, -4782], [35481, -8563, 871, -39, -1134, -598, 216, 1612, 2094], [64096, 16768, 3319, -253, -272, 282, -3113, -1728, -506], [-66226, 15440, 1630, 2390, -24, 1080, -2084, 1116, 1680], [17582, 16270, -26, -2154, 2954, -4102, -1974, -1064, 192], [80746, -18898, -799, 822, 4021, -253, 3627, 3292, -1848], [-42342, 19632, 1310, 1866, -1760, -1498, -3886, -2870, 502], [15891, 6651, -6263, 1527, 5654, -1098, 3290, 3114, 2754], [-41288, 11512, -5709, -4107, 1254, -1168, -589, 800, 1858], [-39705, 16560, 705, 170, -6359, -1939, 2732, 3146, -1858], [64340, -3769, -3371, -1999, -5221, 3173, -6726, -257, 888], [27257, 11095, -739, -1169, -9897, 1351, -4297, 1673, 1615], [-19119, -8094, 8101, 5011, 1938, 4651, 180, -1861, -4635], [-52356, 9260, 230, 2550, -4618, -1500, -4564, 254, 50], [-50164, 8821, 5256, -1104, -3496, 3039, 3430, 691, 3251], [-42630, 16170, -2152, -1474, 3630, 119, 220, 2681, 889]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1856_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1856_4_a_bg();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_1856_4_a_bg(:prec:=9)
    chi := MakeCharacter_1856_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_1856_4_a_bg();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_1856_4_a_bg( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1856_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![396802, 439999, 30654, -85158, -10822, 5872, 394, -138, -4, 1]>,<5,R![-37835002, 21340421, 7153684, -4664192, 256400, 85426, -4532, -568, 10, 1]>,<7,R![-1638662144, -1487601664, -333385728, 2377728, 6862272, 407984, -17936, -1296, 12, 1]>],Snew);
    return Vf;
end function;