import { intToNat, natToInt, divBy2 } from './nat';


const params: URLSearchParams = new URLSearchParams(window.location.search);
const nStr: string|null = params.get("n");

if (nStr === null) {
  console.log('You forgot the input "n"!');
} else {
  const val = parseInt(nStr);
  if (isNaN(val)) {
    console.log(`Not a valid integer: ${nStr}`);
  } else {
    const n = BigInt(val);
    const n2 = natToInt(divBy2(intToNat(n)));
    console.log(`${n} / 2 = ${n2}`);
  }
}
