// can multiply a number with a fixed other number // input: S (number) // output: S (number) static class LMath2 extends LearnerImpl { static boolean debug; BigInteger factor; public void processInOut(Object _in, Object _out) { if (debug) print("LMath2: in = " + struct(_in)); S in = cast _in; S out = cast _out; BigInteger[] inNumbers = new BigInteger[] {bigint(in)}; BigInteger[] outNumbers = new BigInteger[] {bigint(out)}; findOperation(inNumbers, outNumbers); } public void findOperation(BigInteger[] in, BigInteger[] out) { if (l(in) != 1 || l(out) != 1) tilt(); BigInteger f = out[0].divide(in[0]); if (!eq(out[0], in[0].multiply(f))) tilt(); if (factor != null && neq(factor, f)) tilt(); factor = f; } public String processIn(Object _in) { S in = cast _in; BigInteger[] inNumbers = new BigInteger[] {bigint(in)}; ret str(inNumbers[0].multiply(factor)); } }