+ 12

Challenge: betrothed numbers

Betrothed numbers (quasi-amicable numbers) are two positive integers - m,n - satisfying the following relation: sum of dividers of m is n+1 AND sum of dividers of n is m+1 Examples are: (48, 75), (140, 195), (1050, 1925) task: write a code that, given an upper limit, finds all betrothed numbers from 1 to limit and displays the couples write code in any language you prefer :) additional task (the easy part :D): display the couples' count in the given range! good work!

22nd Aug 2017, 7:14 PM
Luca
Luca - avatar
47 Answers
+ 13
My try. [HTML,CSS,JS] https://code.sololearn.com/WvRowj9um83m/#html You will like it a lot!
22nd Aug 2017, 9:32 PM
Louis
Louis - avatar
+ 12
please share
24th Aug 2017, 8:14 AM
Kiew Yuan
Kiew Yuan - avatar
+ 12
Hello please share
24th Aug 2017, 8:14 AM
Kiew Yuan
Kiew Yuan - avatar
+ 10
thank you
24th Aug 2017, 8:14 AM
Kiew Yuan
Kiew Yuan - avatar
+ 10
the problem all the answer please?
24th Aug 2017, 10:56 AM
Kiew Yuan
Kiew Yuan - avatar
+ 9
@Luca Finger trouble, working now.
22nd Aug 2017, 9:45 PM
Louis
Louis - avatar
+ 4
@Baptiste 48 is also divisible by 3 :) anyway, here there is wikipedia page about betrothed numbers https://en.wikipedia.org/wiki/Betrothed_numbers i think wikipedia is better than me at explaining :D
22nd Aug 2017, 7:36 PM
Luca
Luca - avatar
+ 4
My attempt in PHP: https://code.sololearn.com/wO40M7D6815K/#php Got a little longer than expected because I had to filter duplicates.
23rd Aug 2017, 6:25 AM
denk_n
denk_n - avatar
23rd Aug 2017, 8:33 PM
Sanjeev Kumar
Sanjeev Kumar - avatar
24th Aug 2017, 1:09 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 4
Betrothed numbers https://code.sololearn.com/ct5au1faVoS5/?ref=app if you input 6200, you get this: [[48, 75], [140, 195], [1050, 1925], [1575, 1648], [2024, 2295], [5775, 6128]] total: 6
24th Aug 2017, 3:56 AM
hamletmun
hamletmun - avatar
+ 3
@Baptiste sure, you're right, i forgot... added in the OP!
22nd Aug 2017, 7:14 PM
Luca
Luca - avatar
+ 3
this is my c++ version... Just for :) https://code.sololearn.com/cCYnJQCMaX8j/?ref=app
22nd Aug 2017, 8:41 PM
Luca
Luca - avatar
+ 3
@Kiew which problem? this is a challenge thread, task was provided in the OP and answers are solution codes/comments on them... no problems :)
24th Aug 2017, 12:06 PM
Luca
Luca - avatar
+ 2
Can you give an example of betrothed number please ?
22nd Aug 2017, 7:07 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
@Baptiste congratulations, i really like your code!
22nd Aug 2017, 8:28 PM
Luca
Luca - avatar
+ 2
@Antoine here is your code corrected. I saved it as mine only to share the link, all credits (as stated in the code) go to you! https://code.sololearn.com/WxV9u93upSTD/#html
22nd Aug 2017, 9:11 PM
Luca
Luca - avatar
+ 2
again, thanks everybody for participating the challenge, very appreciated 😊 please give an upvote if you liked it, so (maybe) other users can see it and enjoy it too 😁 hope to see a lot of new answers with new codes!!!
22nd Aug 2017, 9:31 PM
Luca
Luca - avatar
+ 2
@ysraelcon nice code! may i suggest you to add a control to remove duplicates? :)
22nd Aug 2017, 9:59 PM
Luca
Luca - avatar