+ 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.
18 Answers
+ 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
+ 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
+ 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
+ 14
this is my try check it guys😊😊
https://code.sololearn.com/cHGFYya05luZ/?ref=app
+ 11
Gawen ur question is not too clear
+ 11
Gawen, my try
https://code.sololearn.com/cHN0lc429Bw1/?ref=app
+ 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
+ 7
I made one that I think can do 10^11 but the memory limit exceeded.
+ 7
Gawen, your code is amazing 👍
Here's my try:
https://code.sololearn.com/cyEfkvQc12Cy/?ref=app
+ 6
gawEINSTEINasy series! 😱😱
+ 5
https://code.sololearn.com/cZVIXGQTlI9u/?ref=app
+ 4
Here is my try
https://code.sololearn.com/cKO3o0h4HsP6/?ref=app
+ 3
Here is my try.
My code isn't efficient to solve N=11 case in CodePlayground..
https://code.sololearn.com/cGv9UZZkqnCm/?ref=app
+ 3
another solution in python:
https://code.sololearn.com/cqeVrlCQphKu/#py
+ 2
my python solution:
https://code.sololearn.com/cVM1qTEnK6Y9/#py
+ 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 😥