Tags: misc
Rating: 3.5
# Challenge
When connecting using ```nc challs.m0lecon.it 10000``` we get the response:
```Hello!
I'll give you a positive integer N, can you give me two positive integers a,b such that a>b and gcd(a,b)+lcm(a,b)=N?
You must send the values of a and b separated by a space.
You have 1 second for each of the 10 tests.
N = <number>
```
where ```<number>``` is a random number.
We must send for each given N, two positive integers a,b such that a>b and gcd(a,b)+lcm(a,b)=N.
# Solution
If ```b = 1```, then ```gcd(a,b) = 1```
If ```b = 1```, then ```lcm(a,b) = a```
```gcd(a,b)+lcm(a,b) = a+1```
```a+1 = N```
```a = N-1```
That is it. For each ```N```, send ```a = N-1, b = 1```
[solve.py](solve.py):
```py
from pwn import *
r = remote("challs.m0lecon.it",10000)
for i in range(10):
r.recvuntil("N = ")
N = r.recvline().replace("\n","")
a,b = int(N)-1,1
print a,b
r.sendline(str(a) + " " + str(b))
r.interactive()
r.close()
```
Output:
```
[+] Opening connection to challs.m0lecon.it on port 10000: Done
161 1
50187 1
127208033 1
8107440147697982075 1
332130426655658197423537061788629962749 1
94256884964115867360289804878012338944796608784081239976380862940309171390904 1
11708017888569831203677521177979843472922665846732320401270170607479920268930647397256106491995408185002388753979722805389129171939980433913408769315098919 1
49218745162474121777159684663363806200293564621767440332848454431690193315119623040193837038490855078381639077715429650350691168392573369432944214844881587881839583227405935977069363424137619510792130676584645356804947578145896660709099692249678555757186767209425887723901496397541644652128575656573009315701 1
26189513614333189527967126799629321517371213901857375493148601510710141131754052662333249861966421753915650987553274429883809736611591281265932763846917373661849469115992637233120486789026594364033880804046467453243430054081569101292023642453728684761520229210150417517866882072602450432466183581860678780910627159284872123345080022471703315713091713112454267859159423108176610642891249385163801053229605682237824269316741286300611826188351576177354115470967181671380641335593647782132307454508060616130806452207630907131459698646489212694201073355048647373841521594413200027520420938560765062404190196681842077147909 1
974861817995726349250923467417258645567950694436081655512554301667811123210153516088442146374065613055400830713968711979897540955722760271003535776569070464351014089135677566586005851469154458926527636757528860373111058212812036529827684832602527806040334156462977320041268732096237561244507606746877216265986061250751646407805946573998169721906495645828620806384996382527339364294916279271012794279313144393876560071841019941378912120675744295904552298412248993182610297640759557034011800622523729253299626617799339383201941000001978557657350460549520992729734098863968041788412594718064423485185564001316485440534939352024591846078374346301229524603903115006868767521935069372585810441106671926528027237567910825127375876292493248251946724173846312026446876793109991090025394917348337616441353854584137642406982947209973009579900889772200999836228533826416041302618440489441045484953387556426715216677374220293297653682818425852542386221140673062275139326757222688761460262526738153448816953017274523304683139001325385049342647756003015035878107469347126860287980459939628562476577571509251080887692202646842372739390746380134222589067340212086847283893988362094715848644991630638351684037049524150098957858223403490499442083995461 1
[*] Switching to interactive mode
Correct!
ptm{as_dumb_as_a_sanity_check}
```
There we have it, the flag is ```ptm{as_dumb_as_a_sanity_check}```