I am a student trying to learn programming on my own, getting help from online sources and people like you. I found an exercise online to create a small program 

The program should read the numbers a and b and count how many numbers between a and b are divisible by either 2, 3 or 5.

If the user types the number 5 and then 8.... it would look at all the numbers in between - 5,6,7,8 and check if any of them are devisable by either 2,3 or 5. And since the numbers 5,6,8 are it would return the number 3 to the user....

Now the problem is that this program only works for small numbers, but when I try to input numbers such as 123456789012345678 and 876543210987654321... it doesn't run at all.Well it runs but the time it takes the computer to check each number is way too long..so it would take years to finish.

Now I am stuck... I want it to work on bigger numbers as well...such as 
 a=123456789012345678 b=876543210987654321 where it will give me the answer 552263376115226339 

Since this is more of a problem for mathematicians ..something to change the algorithm of this program I am turning to you guys for your guidance and help.

There must be a quicker way ...something that can modify the code so it finishes in the matter of seconds not hours. Something that will speed up the process of checking if the numbers are divisible...

Could you please help me with that? Because I am completely lost on what to do. Thank you for your help in advance !