// Magma program for calculating oddPart((2^e)!) mod 2^B // for e = 1..eMax (see OEIS A359349) // // At present, the program runs in about 45 seconds // on the Magma Calculator at // // https://magma.maths.usyd.edu.au/calc // // Jon E. Schoenfield, Jul 09 2023 eMax := 28; // max e for calculation B := eMax + 12; // #least significant bits to keep M := 2^B; fNew := 1; // new odd part factor fPrev := 1; // previous odd part factor ProdModM := [ 1 ]; // oddPart((2^1)!) mod 2^B = 1 for e in [ 2 .. eMax ] do fPrev := (fPrev * fNew) mod M; fNew := 1; for j in [ 2^(e - 1) + 1 .. 2^e by 2 ] do fNew := (fNew * j) mod M; end for; ProdModM[e] := (ProdModM[e - 1] * fPrev * fNew) mod M; end for; ProdModM; // print oddPart((2^e)!) mod 2^B for e = 1..eMax // print table of bits, with least significant bit at left for e in [1 .. eMax] do bits := Intseq(ProdModM[e] + M, 2); bitsStr := ""; for j in [1 .. B] do bitsStr *:= IntegerToString(bits[j]); end for; eStr := IntegerToString(e); if #eStr lt 2 then eStr := " " * eStr; end if; eStr, bitsStr; end for;