From 01c8af3bf6574622a4f650bc7c8e9e1e26c15d60 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 10 Jun 2023 16:59:34 +0200 Subject: Initial commit hehe --- ref4ctory.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ref4ctory.md (limited to 'ref4ctory.md') diff --git a/ref4ctory.md b/ref4ctory.md new file mode 100644 index 0000000..179ecee --- /dev/null +++ b/ref4ctory.md @@ -0,0 +1,24 @@ +# Ref4ctory + +This challenge involved finding the factors of multiple composite +numbers. + +``` python +def check_factors(a,b,ab): + if abs(a)<=1 or abs(b)<=1: + print("too easy") + return False + if type(a*b) == float: + print("no floats please") + return False + return a*b == ab +``` + +The `check_factors` function disallows floats and factors $-1\le a\le 1$ +and $-1\le b\le 1$. + +Our quick-and-dirty strategy was therefore to use the factor $a=2$ and +$b=ab/2$ if $a\pmod2=0$. If $a\pmod2\ne0$, we would use wolframalpha's +prime factorization (because primes are awesome). While we had some +problems with typing fast enough (`ncat` timeouted), we got the flag +using this approach in the end. -- cgit v1.2.3