Challenge: Simple And Easy Number Division | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
+ 26

# Challenge: Simple And Easy Number Division

Consider positive integers that are divisible by 7, and are also divisible by 7 when you reverse the digits. For instance, 259 counts, because 952 is also divisible by 7. The list of all such numbers between 0 and 10^3 is: 7 70 77 161 168 252 259 343 434 525 595 616 686 700 707 770 777 861 868 952 959 The sum of these numbers is 10,787. Find the sum of all such numbers betwen 0 and 10^11. Make your program work for an upper limit of 10^N for any N, and be able to efficiently handle N's much larger than 11.

18th Oct 2017, 10:22 AM
GAWEN STEASY
18 Réponses
+ 19
/* for those who don't understand the challenge 👇 find sum of numbers between 0 and 10^n where n is a positive integer(obviously) , numbers must be of form 7x and its reverse of form 7y , where x,y belongs to set of natural number //hope i explained well , & it makes sense 2 u ☺ */ ⬜🌹🌹🌹🌹🌹⬜ 🌹⬜⬜⬜⬜⬜⬜ 🌹⬜⬜⬜⬜⬜⬜ 🌹⬜⬜⬜🌹🌹🌹 //here is my try 👇 (& yes , thats v. easy when u understand what is the question ) 🌹⬜⬜⬜⬜⬜🌹 🌹⬜⬜⬜⬜⬜🌹 ⬜🌹🌹🌹🌹🌹⬜ https://code.sololearn.com/cx98ungMZe6w/?ref=app
18th Oct 2017, 10:27 AM
Gaurav Agrawal
+ 16
@gawen , in mine code , time limit exceeded for 10^11 , //but , i have made it to take least time , u can see the code ... if some improvement can be done ... then tell //it will work for 10^3
18th Oct 2017, 12:24 PM
Gaurav Agrawal
+ 15
@Gaurav I mean you have first take number which reverse is also divisible by 7 and then you have to sum that numbers and print it the range should be satisfied any user input
18th Oct 2017, 10:53 AM
GAWEN STEASY
+ 14
this is my try check it guys😊😊 https://code.sololearn.com/cHGFYya05luZ/?ref=app
20th Oct 2017, 7:54 PM
GAWEN STEASY
+ 11
Gawen ur question is not too clear
18th Oct 2017, 10:31 AM
David Akhihiero
18th Oct 2017, 3:49 PM
David Akhihiero
+ 8
Don't know if it works or not. You can't run it on code playground because it takes too much memory. Try to run it on a different compiler. https://code.sololearn.com/c1e37LU4Sg40/?ref=app
18th Oct 2017, 2:20 PM
qwerty
+ 7
I made one that I think can do 10^11 but the memory limit exceeded.
18th Oct 2017, 1:46 PM
qwerty
+ 7
Gawen, your code is amazing 👍 Here's my try: https://code.sololearn.com/cyEfkvQc12Cy/?ref=app
21st Oct 2017, 9:07 AM
LukArToDo
+ 6
gawEINSTEINasy series! 😱😱
21st Oct 2017, 6:25 AM
Kartikey Sahu
18th Oct 2017, 5:16 PM
Natalia
+ 5
https://code.sololearn.com/cZVIXGQTlI9u/?ref=app
18th Oct 2017, 9:19 PM
Curly Fries
18th Oct 2017, 6:08 PM
Ferhat Sevim
+ 3
Here is my try. My code isn't efficient to solve N=11 case in CodePlayground.. https://code.sololearn.com/cGv9UZZkqnCm/?ref=app
19th Oct 2017, 3:49 AM
Hiroki Masuda
19th Oct 2017, 11:35 AM
m_sudhu
21st Oct 2017, 11:41 AM
Molnár Zsolt
+ 2
21st Oct 2017, 11:40 AM
Molnár Zsolt
+ 2
https://code.sololearn.com/c6JrqYEeT8eA/?ref=app Will work till 10^1000000 but not completed yet. I just need 2-3 more lines to write which I don't know 😥
21st Oct 2017, 11:40 AM
Kartikey Sahu
Aujourd'hui en vedette
Bash