by saagarjha · 6y ago · 0 comments
Here's my solution. I wouldn't normally post it publicly, but I've emailed OP multiple times over the last couple months to apply for this position and have received no response, so maybe this is actually the best way to get around the spam filter:
from z3 import *
s = Solver()
x = Int('x')
divisor1 = x / 611939
divisor2 = x / 598463
modconstraint1 = (x - (611939 * divisor1)) == 145767
modconstraint2 = (x - (598463 * divisor2)) == 109572
s.add(modconstraint1, modconstraint2, x > 0)
s.check()
email_bin = '{0:b}'.format(s.model()[x].as_long())
email_b128 = []
for i in xrange(0, len(email_bin), 7):
email_b128.append('0' + email_bin[i : i+7])
email_bytearr = map(lambda c: str(unichr(int(c, 2))), email_b128)
print(reduce(lambda x, y: x + y, email_bytearr, '') + '@inpher.io') const num = findNum();
const bin = num.toString(2);
const byteStrings = toChunks(bin, 7).map(chunk => chunk.join(''));
const bytes = byteStrings.map(str => parseInt(str, 2));
const str = bytes.map(String.fromCharCode).join('');
console.log(num, bin, byteStrings, bytes, str);
function findNum(i=0, lim=1e1000000000) {
while (i < lim) {
if (i % 611939 === 145767 && i % 598463 === 109572) return i;
i += 1;
}
}
function toChunks(iterable, chunkSize) {
const chunks = [];
for (const el of iterable) {
let buf = chunks[chunks.length - 1];
if (!buf || buf.length >= chunkSize) {
buf = [];
chunks.push(buf);
}
buf.push(el);
}
return chunks;
}
243085550 1110011111010011000011101110 [ '1110011', '1110100', '1100001', '1101110' ] [ 115, 116, 97, 110 ] <xxx>
Sorry about not getting a response from the poster of the job, by the way. It's a very unhealthy attitude and it's sad to see this on HN of all places. x = 145767
while x % 598463 != 109572:
x += 611939
s = ''
while x:
s = chr(x % 128) + s
x //= 128
print(s) from z3 import Int, solve
x = Int('x')
solve([x % 611939 == 145767, x % 598463 == 109572])
[x = 243085550]
Also: please use python3, it's 2020 :(
And a simpler conversion to base128 would be: print(''.join(chr((x // 128**i) % 128) for i in range(3, -1, -1)))