
// Make newform 1840.4.a.bb in Magma, downloaded from the LMFDB on 20 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_1840_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_1840_4_a_bb();".
// 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_1840_4_a_bb();".
// 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 := [-43712, 627136, 1222472, -149461, -259871, 5872, 12958, 42, -204, -1, 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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [-41, -1, 1, 0, 0, 0, 0, 0, 0, 0], [15927316040736, -16921771204196, -15186810570573, 1863152202667, 969699259072, -52533030922, -16966937858, 723349168, 89269783, -3854981], [-14421069607200, -11104850228084, 3320453096103, 1551591559273, -215575562744, -67076321674, 3713138890, 958382440, -18632021, -4287527], [115237989620584, -79734314857444, -41141880130997, 20114961714183, 1813891775908, -974051270338, -32852266542, 15013259412, 196190847, -72608749], [8867676107504, 72305838824020, -4724945311075, -12496323365715, 211662778568, 572042196850, 1706664114, -8659056120, -38587743, 41435197], [273658774052288, 514271154017812, -79286193459079, -121548442958439, 2380312790336, 5982905567554, 29305755546, -93405512736, -514489611, 456055897], [17109836030200, 66174933803024, -11523548352956, -12645671642919, 636739850680, 625434057344, -3859706262, -9854440296, -20806896, 48402857], [-92807654043212, -340208034284128, 11055210179941, 76051496979801, 303529809586, -3913068398836, -50573267814, 62814279954, 511006659, -312403603]];
    Rf_basisdens := [1, 1, 1, 649381829040, 389629097424, 2922218230680, 1168887292272, 5844436461360, 584443646136, 1461109115340];
    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_1840_a();"
function MakeCharacter_1840_a()
    N := 1840;
    order := 1;
    char_gens := [1151, 1381, 737, 1201];
    v := [1, 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_1840_a_Hecke(Kf)
    return MakeCharacter_1840_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], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [-5, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-3, -1, 0, 0, 0, 0, -1, 0, 0, 0], [2, 1, -1, 1, 1, -1, 0, 0, 0, 0], [2, 0, 0, 0, 1, -1, 1, 0, 0, 0], [8, 0, 0, 1, 1, -1, 0, 1, 0, -1], [-11, -1, 1, 1, -1, -1, -2, 0, 0, -1], [-23, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-29, -6, 1, -1, -1, 0, -4, -1, 2, 2], [12, 9, 2, -2, 2, -1, -4, -1, 0, -1], [6, -9, -3, 0, 0, -2, -2, 1, -2, 1], [74, 14, 0, -1, 2, 2, -4, 2, -1, -1], [-37, 12, 6, 0, -4, 6, -2, -6, -3, 2], [28, 13, 6, -3, -3, 4, -4, -4, -1, 1], [54, 5, 4, 0, -1, -2, -7, -1, 0, 1], [-85, 33, -1, -3, -5, -6, 1, 2, 2, -3], [25, 26, 0, -3, -1, 6, 0, 0, 6, 3], [-119, 63, -4, 9, 2, -2, -4, 6, 4, -3], [-125, 13, -6, 9, 7, 1, 1, 2, -7, 6], [196, 15, 5, 0, -7, -4, 10, 1, 6, -1], [-322, 40, -13, 4, -3, 0, 3, 8, 2, 6], [-46, 27, 2, -3, 8, 6, 6, -18, -13, -3], [469, -12, 10, -5, -7, 4, -15, -1, -10, -4], [242, -3, -17, 21, 7, 1, 22, 6, 6, 4], [159, 105, -15, 0, 16, 2, 18, 1, 1, -11], [-190, -28, -10, 6, 4, -2, -3, 13, 6, 1], [-113, 53, -4, 21, 4, -16, -8, 4, 6, 3], [155, 42, -26, 16, 27, -24, 28, 5, 12, -11], [270, 27, 7, 0, -16, -8, 28, -1, 6, 3], [49, -59, 25, -6, -9, 4, -46, -11, 1, 5], [68, -109, 29, -13, -2, -8, -33, -10, 5, -11], [911, -13, 4, 0, -1, -3, -30, -7, -1, 3], [-48, 42, -21, 10, 2, 16, 37, -10, -6, 28], [-124, 116, -26, 12, -1, 0, -30, -3, 3, 19], [310, -42, 3, 14, 18, 35, -12, 6, -21, 7], [514, -77, -33, 22, 20, -18, 18, -15, -6, -9], [-6, 17, -14, 4, 29, -36, 21, -8, 17, -20], [-131, -64, -35, 34, 15, -32, -35, 14, 35, -10], [-254, 37, 8, -26, -15, 1, -2, 35, 27, -26], [125, 49, 10, 35, -9, -24, 14, 2, 26, -5], [-9, -86, -4, 8, -17, 28, -26, -35, -8, 5], [-106, -238, -12, -4, 6, 8, 18, -20, -14, 10], [1173, 105, 4, 26, 4, 24, 39, 9, -15, -21], [421, -90, -4, 2, -13, -19, -109, 50, 28, 27], [-748, -64, -9, 45, -6, -32, -68, 5, -3, -32], [-876, -195, -34, 19, 22, -2, 48, 26, 27, 25], [513, -64, -13, 39, 68, -24, -26, -33, 14, 28], [691, 30, -10, -16, -18, 4, 22, 24, -15, 4], [1091, -26, -22, 63, 15, -34, 3, 43, -12, -36], [712, -39, -17, 37, 34, 4, 9, 0, -3, 27], [1466, -28, 73, -58, 30, 34, -39, -16, -46, -18], [932, 180, -14, -1, -27, -14, 9, -7, -13, 2], [-57, -113, 8, 3, -4, 71, -29, -16, -46, 3], [937, -171, -22, -35, 41, -24, -58, 0, -18, 45], [1097, -269, -44, 13, 0, 70, 77, -27, 12, -18], [-433, -58, -11, -5, -9, 46, 184, -3, -8, -10], [189, -88, -2, -3, 69, -73, 20, 1, -12, -4], [2018, -169, 113, -19, -40, 6, -53, -42, 7, 45], [1125, -96, -46, -54, -10, -40, -100, 80, 25, 22], [-440, 9, -58, -23, -22, -16, 122, 14, 27, -27], [-918, -297, 26, 24, 63, -88, 3, -45, -26, -11], [1855, 164, 59, -12, -3, -48, 28, -3, 5, 19], [1597, -161, 16, 47, -35, -104, -108, 94, 40, 1], [-1629, -248, -106, -32, 38, -31, 9, 36, 39, -74], [-1523, -525, 68, -69, -52, 55, 45, -66, 50, 25], [-2246, -256, 115, 32, -32, -88, -133, -38, 70, 8], [1719, -25, 35, 72, -8, -45, -97, 59, 21, -49], [-129, -458, -7, -5, -12, 102, 1, -122, 12, 39], [-2061, 168, 159, -37, -83, 14, -96, -31, 52, -24], [-2840, 525, -65, 33, 52, 22, -221, -64, -81, 17], [144, -278, 7, -97, -60, 100, -6, -27, 19, 44], [836, 111, -22, 47, 28, -56, 226, 86, 91, -35], [-1706, 8, -6, 32, 60, 108, -38, -66, -14, 66], [698, -289, -64, 74, -23, -19, 52, 23, -11, 24], [3203, -179, -146, 1, 50, 16, -10, 22, 36, 29], [1070, 524, 6, 116, 70, -176, -75, 117, 34, 13], [2071, 314, -24, -41, 66, -61, -36, 69, 15, 23], [-1412, -122, 128, 20, -56, 82, -194, -54, -14, 0], [93, -278, 145, -82, -131, -38, -79, -39, -48, -25], [730, 14, 133, 4, -207, -30, -167, -40, 36, 46], [473, 214, -8, -117, 136, 102, -39, -126, -51, 33], [-974, -670, -21, 1, -42, 2, -76, 103, -43, -56], [-21, 718, -72, 0, -28, 31, -69, 118, 3, 40], [-960, 268, -80, -97, -74, 59, 124, 39, -51, 48], [2141, -357, -91, 63, -55, -92, -305, 67, 83, 50], [445, 565, 75, -73, -126, 174, -79, 15, 31, -36], [1746, -1039, -94, 64, -69, 82, -21, 7, -104, -19], [1626, 829, -26, -173, -21, -66, 172, 176, 51, -45], [4409, -358, 263, -157, -214, 106, -76, -165, -26, 72], [1290, -173, -208, -109, -26, 28, 128, 72, -47, 89], [1648, -352, 222, -48, -82, 68, 118, -72, 74, 10], [-591, -1359, 53, -102, -3, 48, 184, -23, -63, -81], [-1238, -296, 217, -18, -146, 10, 105, -38, 112, -96], [155, -672, -18, 60, 89, -148, -326, -104, 99, 68], [4756, 13, -78, 16, 124, 104, -13, -134, -21, -44], [-1115, 233, 119, -11, 30, 114, -147, -30, 74, 103], [3138, 40, 138, 49, -85, -136, -247, 25, 67, -70], [-1689, -22, -22, 16, -18, -20, -464, 30, -19, 106], [-6383, -59, -307, -11, -88, 70, 349, 116, 28, 119], [-3660, -45, -78, -36, 77, -128, 335, 4, 113, 60], [5500, 71, 83, -36, 110, 108, 250, -113, -110, 71], [6096, -507, -94, 77, -42, -30, -184, -80, -37, -91], [6416, -124, 118, -114, -142, 268, -82, -154, -168, 2], [-11314, 225, -92, -96, -51, 91, -42, 23, -23, 188], [3842, 1243, -247, 176, 183, -286, -98, 101, 24, -91], [-2330, -781, -140, 83, 69, 58, -275, 35, 33, -162], [617, 912, -77, 119, 174, -256, -30, 317, 138, 78], [-1781, -935, -33, 77, -123, 29, 394, -76, -7, -146], [5424, -386, 268, -34, 184, -160, 6, 63, -23, 105], [-5953, 830, 159, -265, -366, 208, 140, 73, -32, 10], [-3130, 84, 202, 86, -90, -258, -504, 64, 44, -104], [6776, -632, -111, -161, -160, 41, 105, 33, 120, 75], [-4437, 413, 10, 97, 246, -153, -131, -212, -8, -75], [-10414, 244, 135, -251, -182, -20, 40, 131, 73, 90], [4619, -1382, 114, 168, -112, 206, -280, -224, 49, 82], [1648, 1623, -110, 163, -124, 176, 162, 0, -39, 87], [3026, 621, -126, 218, 150, 248, 27, -149, 36, 55], [-2063, -438, 93, -285, 35, -49, 305, -75, 160, 72], [-1386, 90, 18, 203, 235, -6, 299, -33, -143, -38], [1092, -870, -8, 22, -18, 244, -83, -65, -114, -107], [-1618, -767, 235, -145, -84, 216, -327, -240, 35, -105], [364, -101, 2, 116, 103, 326, 41, 57, -106, 103], [4445, -935, 125, 33, 169, 64, -105, 137, -93, -70], [-3528, -266, 90, -332, 266, -42, 148, 18, -12, -40], [-8665, -160, -90, -31, -184, 202, 523, -60, -37, -151], [-145, -384, -162, -1, 15, 358, 288, 118, 62, 23], [167, -468, -46, -13, 135, -51, 192, 55, 28, -40], [-11128, -519, -72, 149, 120, -122, 73, 225, -61, -76], [2686, -113, 74, 24, -115, 2, -323, 109, -124, 115], [1421, 182, 70, 384, 99, -130, -178, -68, -65, 80], [1604, 260, 42, 287, 228, -248, 203, 56, -46, 73], [-12122, 1076, 471, -113, 174, 198, -16, -141, 29, 12], [1958, -2715, -55, -82, -14, 102, -224, -151, -8, 57], [2220, 168, -24, -372, 56, 96, -90, 27, -9, 163], [1240, 116, -400, -124, 276, 190, 32, 102, -48, 48], [-3736, 1062, -119, 250, 89, 118, 127, 130, -164, 116], [-8182, -1081, 162, -71, -170, 214, 98, 24, -127, -109], [4874, 87, 275, 58, -206, -212, -238, -233, -18, 133], [4475, -195, 109, 274, -348, -488, -27, 304, 157, -198], [-9868, -2838, 161, 66, 22, -236, 215, 182, 120, 142], [-4265, 926, -139, 260, 239, -86, -95, -92, 79, 196], [-6338, -1147, 74, 26, -236, 270, 93, 349, 70, -131], [8036, 1393, 318, -259, -50, 34, 442, -142, 23, 67], [-5183, 355, 431, -46, -524, -90, -348, 19, 133, -273], [-2264, -872, 235, -559, -240, 50, -650, 65, 111, 222], [-6041, 891, 228, -619, -334, 85, -303, 244, 86, -99], [9836, 597, -439, 527, 136, -130, 149, 90, 3, -3], [-11156, -508, -153, 72, 40, -422, -587, 532, 172, -292], [7910, -285, -276, -255, -173, 78, 340, 32, 21, 181], [-8326, -2187, -274, 461, -14, -215, 341, 52, -196, -336], [-2144, 222, -384, 211, 243, -128, 349, -19, -107, -4], [-7283, 2298, 145, -382, -210, 568, 319, -223, -78, 97], [-1479, -1337, 69, 30, 77, 86, -16, -537, -233, 31], [-7159, -1303, -32, 115, 80, -376, 488, 114, 218, 105], [-17514, -294, 213, 189, 168, -500, -456, -67, 59, -162], [-2352, 2172, -603, 393, 466, -204, 102, -75, -201, 166], [8808, -1350, -204, 223, -106, 270, 349, -153, -135, 212], [15281, 949, -937, -196, 176, 87, 369, 373, -49, 237], [-7266, -1830, 396, 179, 173, 10, -1006, -242, -195, -7], [8871, -1173, -481, 506, 370, -118, 588, 520, -40, 142], [-4258, -2881, 160, -255, 254, -417, 127, -90, 28, -22], [8931, -555, 635, -99, -6, 10, -71, -134, -86, 35], [-2318, -735, 472, -223, -560, 147, 13, 138, -84, 126], [-1891, 1762, -135, -114, -175, 91, -554, -70, -243, -204], [5254, -1057, 260, 39, -176, -430, 93, 281, 163, -46], [-18180, 54, -394, 434, -22, -685, 47, 316, 169, -441], [5682, -498, 532, -284, -888, 368, 24, -110, -80, 200], [24601, -3510, 24, -241, -161, 0, -113, 7, -158, 100], [-11554, -540, -543, 386, -76, -797, -448, 526, 483, 11], [-9036, -1030, -295, -581, 18, 704, -520, -387, -147, 238], [508, 1480, -220, 627, 340, -392, 407, 261, 351, -202], [2504, -392, -388, -108, 210, 226, 1036, -48, -148, 126], [8744, -3514, 98, -11, -555, 713, 86, 363, 90, 243], [1701, 2270, 406, -138, -337, 281, -139, 112, 180, 221], [6345, -3980, -634, 235, 33, 44, 47, 133, -248, -308], [-12274, -2693, 721, 41, -354, 134, -955, -302, 275, 237], [-18812, -3626, 402, -81, 182, -502, -467, 143, 111, -104], [567, 3847, 4, 69, 28, 226, 135, -181, 18, 96], [-1224, 3160, 244, -21, 122, -506, 191, -206, -90, 31], [6513, 2467, -965, 235, 544, 290, 395, 58, -202, 191], [12110, -3193, -263, -312, 502, 291, -71, -237, -243, 340], [2084, -2210, 596, -109, -92, -23, -534, 63, -127, 18], [3126, 176, -104, 414, 356, -96, -226, -108, -226, 180], [12374, 2033, -116, -135, 248, 38, 409, -259, 125, -136], [-4598, -1296, 228, 217, 580, -86, 989, 208, 114, -185], [2766, -13, -153, 271, 923, -607, -314, -16, 21, -205], [9229, 595, -498, -151, 624, -396, 2, 64, 170, 177], [2341, -3326, -133, 621, 37, -540, -749, -30, 374, -359], [8292, 486, -666, 258, 158, 161, 137, 528, 147, 61], [-10384, -2289, -91, 183, -192, -28, 575, -244, -69, -143], [7117, -540, 111, -438, 649, -586, 199, -168, 113, -106], [-8902, -2920, -322, 276, -424, 680, 2, -108, 2, 8], [-3793, 1199, 213, 482, 202, -510, 382, -293, -203, 329], [13918, 3132, -14, -228, 408, -58, -494, -58, 154, -342], [11427, -5150, 5, -414, 31, -15, 824, -182, 143, -272], [-6549, 4008, -620, 730, 244, -74, 1272, -190, -91, 88], [11456, -2118, 740, -234, -132, 12, -1354, -312, -448, -56], [1488, -4658, 110, -1030, -278, 188, 4, 104, 356, 396], [2278, -3643, 470, -125, -325, -460, -500, -406, -245, -57], [-10098, -554, -170, 357, 393, -554, 582, 616, -1, -107], [-5074, 2613, 967, -794, -444, -207, -81, -307, 236, 169], [3234, -2736, -141, 132, 422, -145, 1412, 272, -67, 199], [1851, -436, -332, 1, 447, 156, 345, -739, -50, 56], [5444, 788, 574, -335, -349, 414, 1463, -113, -99, 220], [1000, 3915, 689, 438, -191, -136, 924, 297, -130, -179], [-756, 1648, 705, -982, -313, 316, -455, -266, -500, -158], [17741, -3687, -583, -21, -168, -176, 740, 349, -230, -332], [13436, -1954, -868, -20, 386, 280, 1584, 251, -443, -101], [-12650, -1107, -979, 89, 136, -88, -51, 300, -127, 41], [36686, 3209, 109, 442, 115, -28, -22, 105, -196, -537], [-258, 241, 686, 361, 131, -372, -660, -78, 9, -109], [-20773, -2082, 306, -535, -534, 968, -101, 156, 55, 101], [24574, -1238, -6, 170, -76, 664, 872, -318, -242, 230], [11012, 4387, -508, 273, -420, -396, 982, 440, 449, 61], [-11075, -4386, 364, 332, -756, 432, -682, -232, -297, 532], [4791, 3649, -1255, 671, 200, 594, 1881, -308, -184, 175], [-9651, 5744, -869, 431, 141, 360, 1944, -253, -120, -196], [40218, 1669, -36, -110, -482, 164, -193, 34, 345, -162], [8715, 759, -130, 390, -144, 250, -717, -433, -141, -89], [-7965, 4104, -201, 399, 623, -490, -802, -293, -248, -82], [11462, -2596, 465, -31, -302, 460, 120, -435, 275, -34], [29301, 2456, 235, 101, 191, -1128, -1381, 302, 742, -143], [-19717, -1731, 250, 92, -638, 84, -89, 536, 212, -104], [57248, -905, -8, -40, 356, -182, -283, 521, 88, -145], [-2256, -4500, -416, 193, 656, 204, -547, -49, -723, 386], [-1229, 867, 357, -48, -956, 881, 1435, 291, -163, -185], [14327, -1943, 325, 636, -439, -23, -805, 339, 35, 429], [-1378, 1550, -676, -469, -536, -8, 1259, -28, 722, 193], [29632, -2611, -86, 55, -454, -148, 140, -428, -437, 207], [14061, 3471, -1602, 890, 937, -177, -456, 43, -43, -291], [21290, -125, 53, 740, 546, -51, -833, 483, -13, -490], [-14836, 1990, -248, -826, -300, 342, 466, -26, -168, -588], [6094, -917, 464, -568, -777, 182, -1712, -808, -208, 544], [-21820, -2655, 518, 333, -682, 576, -930, -104, -185, 49], [-4761, -66, -1338, -554, 312, 844, -510, -336, -483, -232], [27178, 716, -972, 464, 1264, -800, -1376, -98, 36, 608], [8026, -1032, -257, -220, -89, -70, -131, -252, -254, -208], [-24201, -3764, 228, 316, -387, -206, 1188, -416, 127, 18], [29792, -2181, 551, -271, -36, 669, 420, -254, -186, -288], [15148, 3933, -498, 457, 910, -348, -210, -768, -429, 121], [-4011, -3758, -934, 278, 161, 632, 846, -16, -1207, 212], [26757, -3579, 485, -931, -408, -202, -85, 372, 542, 241], [-17844, -691, -312, 223, -433, 112, -450, 98, 295, -873], [-3858, 1984, -852, 484, 94, -366, -80, 144, 354, 164], [783, -1378, 133, 591, -361, -145, -1133, -485, 558, 348], [12075, 2871, -1177, 483, 378, 910, 1739, -402, -142, 289], [14685, 819, -1356, 917, 1332, -527, -713, -98, 474, 155], [-25206, -57, -154, -366, 441, -743, -154, 807, 853, 40], [7158, -3605, 192, -1175, 206, -18, -627, 509, 117, 132], [234, -3110, 446, -516, -902, -52, 386, -804, 338, 22], [-9754, 2728, 778, -455, -187, 570, 27, 569, 619, -86], [20438, -351, 708, 396, -52, -1080, 49, -628, -333, 106], [36385, -1640, 496, -653, 287, 210, 263, -55, -408, -208], [7921, 662, -157, 369, 140, 356, -1678, 411, 266, -242], [8631, 1108, 168, 408, 11, -752, -2336, 38, 627, -132], [-2609, 2966, 1290, 396, 124, 504, -657, -657, -357, -39], [-26220, -326, -114, -200, 886, -352, -926, 112, -444, 272], [14997, -5184, 709, -675, -1563, 1563, 617, -67, -254, -182], [23552, -3909, 1743, -1236, -1207, 36, -456, 423, 416, -887], [-26090, -897, -266, 287, 888, -1326, 581, 671, -425, -500], [18191, -879, 424, 181, -714, -652, 698, 582, 1046, -215], [-10071, -1035, -365, -716, -42, 314, 1646, 291, 137, 605], [24972, 1017, -1617, 1138, 1478, -1292, 4, 529, 214, -211], [11135, -884, 771, -678, -807, 474, -825, -128, -571, -50], [8832, 1071, 1003, -404, 42, 557, -159, -893, -811, 130], [16801, -5386, 508, 288, 470, -824, -1701, -623, 449, 207], [-8345, -5014, 552, -978, -128, -662, -656, 418, 293, 36], [5237, -1457, 1576, -729, -954, 216, -942, 104, -224, 249], [45257, 3512, 113, 326, 94, 827, -96, -996, -677, -82], [-28784, -1334, -78, -727, -816, 662, -361, -153, -721, -366], [12080, 1037, -694, -345, 608, -970, 2292, -314, 117, -449], [10259, -1902, 383, -630, -291, -53, -1172, -186, 375, 972], [-22470, 1656, 729, -1264, 311, 364, -461, 160, 22, 536], [31167, -1055, 428, 179, 3, 1322, 220, -42, -398, -159], [18823, -393, 533, 1291, -234, -1356, 1391, 192, 682, -467], [21794, -2532, -1040, -260, 74, 130, 2607, 403, -694, -651], [-16725, -3651, -1025, 358, -64, -184, 702, 669, 629, 41], [-19122, 294, 442, -577, -319, 482, 2065, -633, -193, 240], [-42599, -2461, -504, 320, -903, -337, 666, 967, 697, -169], [-9527, -9267, 821, -43, -412, -500, -919, -170, 554, 473], [6020, 1342, 1508, -984, 26, -436, 0, 510, 832, -24], [23245, 2804, -1158, 800, 2062, -1506, -1005, 487, 371, 211], [-1480, -6814, 820, 815, -1135, 230, -47, -57, 489, -26], [2026, 254, 1054, -960, -367, 1354, -684, -503, -233, 287], [-19960, 6802, 1370, -1422, -966, 1289, -1059, -732, -61, 297], [3930, 4713, -892, 1016, 107, -286, 185, -45, -172, 589], [38480, -826, -433, 784, -91, -208, -1157, 888, 216, -208], [-372, 1379, -2494, 1473, 522, -377, -563, 420, 296, 90], [-1281, -140, 113, -1034, -1305, 1114, -346, -183, 593, 323], [32064, -708, -918, 381, 1403, -362, 2583, 299, 39, -636], [32688, -4737, 1320, -1453, -568, 1644, 580, -572, -377, 645], [62852, 412, 92, 1783, -245, -848, -1479, 329, 129, 484], [14321, 5059, -2151, 7, 289, 949, 2498, 218, -558, 595], [37244, -5536, 339, 549, 251, 339, -1297, -1165, -794, 133], [19872, 1020, -690, 37, -935, -522, -1640, 1750, 613, 255], [-33092, 806, -2512, 968, 858, -1028, 1364, 1696, -326, -566], [16849, 5862, 420, -31, -836, -95, 768, 151, 429, 113], [-2118, 5840, -1507, 12, -578, -298, 751, -182, 166, 88], [-28660, 1713, -486, 473, 1725, -306, 31, -57, 765, -220], [16487, 9288, 663, -798, 411, 1863, -106, -1644, -85, 270], [-39304, 1911, -1925, 1514, 74, 370, -618, 1, -452, -305], [-16706, -7680, 540, 927, 1105, -78, -285, -393, -147, 592], [20937, 6269, 481, 477, -1018, 1026, -297, -132, -208, 211], [6381, -7667, 1186, -170, -769, -1371, -1502, 247, 1079, -847], [-11829, -1319, 796, -569, -1011, 948, -118, 94, -234, -319], [24548, -9938, -202, 229, -221, -308, -1340, 360, -127, -529], [-37718, 3504, 840, -1016, 231, 336, -2600, 405, -195, -153], [-31720, 2570, -1200, 126, 56, -148, -1148, -266, -536, -748], [46108, -5487, 1550, -1693, -1424, 427, 1685, 1202, 710, -534], [-2436, 5033, 344, 834, 292, 1098, -1237, -309, -36, 629], [-22581, 10420, 338, 249, 116, -490, 95, -18, 477, -197], [-27614, 4696, 276, -359, -103, 438, 1593, -1255, -1053, 158], [-16573, -1487, -599, -84, 1151, 42, -677, 554, -131, 1018], [22647, -2189, 1194, 174, 756, -1168, -1309, 1464, 426, -718], [-47965, -3982, -1066, -348, -1226, 1456, -500, 420, -355, 1040], [36372, -2036, 487, -1342, -1058, 1196, -1021, -106, -428, -144], [-16764, 2647, 526, 632, 1002, -1283, -2146, 755, 258, -211], [21552, 31, -276, -710, -379, 1406, -1079, 19, 156, 583], [57414, -1945, -1200, -105, -373, -772, 1539, 641, 199, -614], [-27924, 4467, 2573, -1709, -1131, 709, -996, -780, -1026, -364], [-28188, 5564, -781, -15, 238, 99, 3527, -85, 380, -347], [-27219, -1729, 2315, -371, 202, 394, -499, -674, 206, -401], [-32977, 372, 19, -377, 152, -608, -3220, 913, 686, -352], [19146, 2642, 254, -1207, -905, -57, -308, -333, -6, -1411], [-54412, -1268, 680, -805, -1027, -390, 51, -75, -209, -694], [-35719, 261, 166, -762, -1579, -845, 1752, 559, 1047, 413], [-18916, 3233, -92, 13, 804, 1070, 1540, 11, -832, 216], [13043, 3692, 484, -609, -1810, 1320, 3261, -4, 1, -37], [28656, 2971, 940, 832, -357, -1260, 1117, -899, 44, 37], [-13364, 3604, -1602, 115, 1016, 1854, 935, -953, -509, 154], [10344, -6500, -71, 661, 19, 1331, -719, -1321, -610, 37], [-46813, 5634, 556, 134, -671, 56, 2108, -244, 393, -878], [-12643, -93, -233, -14, -510, -246, -1716, -138, 384, -12], [1002, -306, -297, 482, -529, -266, -835, 2214, 1590, 30], [10225, 421, -125, 1311, 665, -1316, 2735, 1075, 825, -346], [11440, 226, -328, 1519, 495, -1518, -130, 554, 1167, -463], [11408, 4398, -1303, 626, 1599, 774, -2395, 866, -286, 52], [-27238, -2393, 228, 273, -187, -664, -3241, 49, 209, -268], [39305, 5331, 1330, -1509, -1686, 1658, 1393, -89, -486, 1150], [-38473, 5715, -1910, 1270, 512, -1450, -601, 235, 603, 511], [36718, 7447, -2067, 1233, 1287, -1065, -1104, 12, -388, 1388], [28169, 4946, -975, -254, 571, -30, 329, -530, 777, -536], [-8276, -1826, 1002, 674, -24, 768, -2576, -854, 280, 630], [-13346, 1309, 1784, -2126, -1647, -180, -1621, 455, 920, 137], [-7964, 10989, -190, 35, 754, -112, 1848, 240, 127, -521], [-29014, -2006, -316, -395, 878, -380, -1379, -217, -485, 186], [35615, -9932, 2201, -975, 673, -6, -2052, -2066, -779, -675], [-4938, -10458, 1070, -723, -885, 2760, -1515, -1113, -829, 24], [-61828, -2649, 434, 118, -147, 1822, -4487, 141, -184, 1225], [53685, 5844, -398, -1262, -1319, 1188, -3540, -528, 153, 414], [-7579, 2509, 322, -1062, -1266, 2728, 2235, 99, -1225, 779], [-6656, -1329, 1744, -1334, -2621, 1668, 283, -809, 188, -713], [-32974, -4291, 1226, -289, 1084, -1006, -1661, -783, 727, -462], [-18438, 4996, 2132, -449, -2547, 2590, -1557, -1643, -321, 232], [-25488, 2674, -806, 541, 395, 844, -1407, -295, -611, 1166], [-8298, 10102, 632, -511, -21, -974, 885, -785, 439, 1248], [18545, -8393, 290, 53, 1214, -1747, 69, -614, 962, 191], [-14436, 4029, 1557, -1757, -488, -548, 1075, -1312, 853, 1019], [-67273, -2794, 5, -130, -2141, 1584, -95, 368, -453, 1796], [-9310, -1151, 1632, -2032, -815, 1910, -1091, -287, -534, -373], [-38774, 4670, 2454, 635, -134, 674, 2267, -1689, -969, 140], [-16897, -1489, -1633, 2172, 2489, 592, 1544, -87, -71, 175], [25046, -3319, 876, 1409, 1360, -2673, 933, 1454, 24, -794], [-14015, -11241, -3051, -38, -117, -982, 101, 1780, 849, -90], [-22658, 8603, -183, 1701, 1404, -2762, 1283, 402, -389, -1383], [-17712, 10628, 1235, -326, 858, -797, 846, 902, 273, -477], [40339, -3671, 160, 2123, 1916, 472, -1354, -580, -590, -575], [876, -5064, 986, -1332, -1226, 358, 3404, 20, -932, 262], [45441, -3942, -956, 704, 1169, 1816, 1304, -1334, -1133, 502], [-13778, 8253, 174, 453, -454, 1762, 142, -1046, -1667, 131], [-12673, -1785, -1445, 928, -439, 1594, 420, 1117, -1455, 157], [15402, -754, 1100, 227, -1819, 470, -3472, -448, 545, 1235], [308, -1144, -924, 1789, -1179, -2330, -2007, 187, 425, 320], [2647, -5052, -2967, 1331, 861, -63, -535, 1279, 558, 890], [25290, -4572, -1939, 566, 654, -944, 2905, -552, -538, 108], [-26396, 7578, -1055, 1243, -846, 1402, -490, 541, 71, 708], [-3140, 3552, -1396, 475, 1325, 1277, 3112, -237, 316, 201], [-24794, -2964, -648, 463, -887, -1246, 73, 2227, 391, -1134], [-63860, -5509, 1471, 1044, 867, -1334, -1168, -775, 1108, -121], [35126, 9254, 1480, -1096, 476, 272, 1209, -1117, 230, -321], [-4, -5827, 1807, -845, -1037, -765, -3694, 252, 400, 342], [33547, 944, -1203, 204, 69, -452, 813, -1282, -1173, 184], [-47916, -5047, 1989, -910, -1003, 2364, 3110, 679, -198, -389], [-47780, -1284, 1211, 1447, -808, 856, -1240, -1565, 181, 56], [24473, 637, 1449, -1059, 1590, -1160, 891, 518, 1298, 791], [21371, -5375, -365, 2560, 923, -2251, 2677, 719, 611, -1515], [80911, 6127, 636, -180, -203, 569, 1406, -1855, -1155, 1089], [-7470, -8733, 1726, -1899, 150, 708, -1262, -908, -1623, -1047], [-6434, -4999, -1848, 776, -488, 568, 1045, 642, 433, 456], [5462, 1890, -2016, 1835, 1957, -1918, 3119, 1123, -325, -756], [-17638, 2781, 1261, -1144, -2280, 3185, 3829, -475, -910, 81], [-8823, 4136, 2838, -926, -2539, -1716, 630, -438, 383, -338], [-40937, 9494, -281, 8, -1723, 650, 647, -128, 29, 700], [44546, -2190, -2057, -574, 1203, -258, 1383, 2154, -44, 166], [-54071, 21034, -144, 474, 582, 1419, 2213, -1128, -973, 396], [-6932, 2832, -1583, -358, 1775, -132, 2207, 1218, -280, -540], [87223, -2138, -2400, 3150, 1042, 24, 2294, 504, 949, 1120], [-62559, -8879, -530, 22, 3307, -311, -3282, -685, -677, -523], [35773, 1427, 423, -1126, -2684, 1054, -1304, 459, 433, 363], [-107431, -148, -1339, 613, -399, 4, -1576, 679, -580, 1670], [-1473, -3687, 762, -1696, 448, 98, 4731, -303, -1021, 423], [12481, 3945, 2268, -389, 1210, -16, 1138, 260, 788, -611], [-52241, -11708, 686, 554, -784, -7, 2495, -306, -131, -682], [-18131, -5584, 3055, 403, -2647, 344, 918, -705, 318, 16], [2196, 8005, -113, -859, -2260, -2759, 78, 592, 2074, 30], [-12852, -1349, -1507, 2318, -184, -2328, 592, 903, 1738, -1153], [-7033, -10393, -2629, 2060, 2070, -2100, 2444, 1530, -1460, 42], [-44925, 6644, -406, 162, 1186, 922, 2930, -2762, -151, -166], [-33878, 4210, -1932, 536, 1284, 670, 520, -1448, 620, 1072], [-44183, 3349, 54, -209, -301, -3360, -3680, 418, 1432, 117], [-36785, -8480, -830, 1747, 106, -917, 176, 623, 199, -1103], [-46655, -5116, -1966, 1304, 1132, -1968, 2868, 1884, -775, -1804], [51110, -4537, -3244, -892, 2441, 1679, 3224, -211, -1707, 518], [-34049, 6184, 153, -738, 407, -171, -3182, 980, -333, 970], [24373, 13519, -1141, -523, -1848, -248, 1853, 908, 244, -941], [-4971, 6465, 2012, 876, 587, -1847, 2698, -171, 1299, -253], [28551, 1880, 317, -1456, -273, 2824, 1571, -306, -559, 776], [-82028, 5292, -995, -63, -24, -531, -5797, 1555, -790, 223], [-24751, 19806, -4280, 1555, 1338, -1324, 4623, 582, 359, -767], [7603, -5030, 3094, -3194, -1300, -940, -51, 701, 1233, 549], [-38152, 2912, -1417, 936, 1319, 1984, 3, -454, -122, 178], [75313, 1626, 2087, -1327, -1734, 1314, -1690, -537, -112, -504], [-47480, -6534, -1524, -2632, 668, 1518, 1210, -1506, -1084, 2192], [-36047, -10717, -2322, -570, -788, 106, 2615, 1585, -291, -345], [40937, -7619, 342, 831, 1587, -1104, -6354, 792, 430, -291], [-44447, 2100, -4014, 3644, 574, -648, 1934, -44, 141, -578], [52956, -6593, -166, 847, 121, -1304, 24, 957, 1410, -602], [13491, -7863, 1310, -1651, -1085, 3858, 1080, -722, -1894, 945], [-80945, 6755, -2262, 385, 2017, 1211, -891, 476, -2097, 1470]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_1840_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_1840_4_a_bb();".
// 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_1840_4_a_bb(:prec:=10)
    chi := MakeCharacter_1840_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_1840_4_a_bb();".
// 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_1840_4_a_bb( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_1840_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![-43712, 627136, 1222472, -149461, -259871, 5872, 12958, 42, -204, -1, 1]>,<7,R![56995990528, 363444632936, -7124849036, -7079160712, -127663083, 34617872, 1019676, -56306, -1904, 28, 1]>],Snew);
    return Vf;
end function;