Highly factorable number
You must print any number n
with n > 0
you like to stdout. Your code must be at least count(n%k for k in 1…100)
bytes long.
Judge
(async function*(context: Context): Challenge { let run = await context.onRunCallback(context.code); // Print run for debug purposes yield new TestCase(`Compilation`,'Info', {"Run": {"input": '', "output": run.stdout, "error": run.stderr}} ); let n = run.stdout.replace(/\s*$/,''); // Is output a number? if (!/^[0-9]+$/.exec(n) || BigInt(n) <= 0n) { let t = new TestCase(`Not a number`, "Fail", {"Text": `Your output must be a number > 0`}); yield context.registerTestCase(t); return context.noFailures(); } // Get divisors of n from 1..100 let nBig = BigInt(n); let dSum = 0; for (let k = 1n; k <= 100n; k++) { dSum += nBig % k ? 1 : 0; } console.log(`Your minimum code length is: ${dSum}`) if (context.code.length < dSum) { let t = new TestCase(`Too small`, "Fail", {"Text": `Your code is too small`}); yield context.registerTestCase(t); return context.noFailures(); } return context.noFailures(); })
Example Code
console.log('41640927904370300154508936603455936348626591748630593262827592445686864000')