I am a database developer,and i have no idea on C++ programming but i am assigned with a task to finish it as someone left it in the middle.Can someone please help me with this.
The number 1406357289 ,is a o to 9 pandigital number because it is made up of each of the digits of 0 to 9 in some order,using each digit only once, but it also has a rather interesting sub-string divisibility property.
Let d1 be the 1st digit,d2 be the 2nd digit, and so on.In this way,we not the foloowing;
d2d3d4=406 is divisible by 2
d3d4d5=063 is divisible by 3
d4d5d6=635 is divisible by 5
d5d6d7=357 is divisible by 7
d6d7d8=572 is divisible by 11
d7d8d9=728 is divisible by 13
d3d4d5=289 is divisible by 17.
Find the sum of all 0 to 9 pandigital numbers with this property.
I know what i am asking is not a small task ,but i badly need some one help to save my job.
If you guys are busy can you please let me know any websites where they do give the solution by charging little amount of money,I am fine with that also.But i need to get it done.
So first thing you need to do is find all possible permutations of 0-9 (YIKES)
Eliminate all of them that begin with 0
Eliminate all of them which the 4th digit is not even
Eliminate all of them which the 6th digit is not divisible by 5
Eliminate all of them which the sum of the 3rd, 4th, and 5th digits are not divisible by 3
When I think of more eliminations, I will add here
But eventually you are going to have to go through the values the way it is done above and multiply by powers of 10 to determine if the product is divisible by the primes listed above (2,3,5,7,11,13,17)
I will suggest using a vector to store the "good" arrays then later find out the size of the vector when using the for-loop