All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Duodecimal Pandigital Divisibility Device (Posted on 2016-09-13) Difficulty: 3 of 5
N is an 11-digit duodecimal positive integer that uses every digit from 1 to B inclusively exactly once, and:
N is divisible by 7.

Devise an algorithm to generate all possible values of N.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re: Choice of two algorithms Comment 2 of 2 |
(In reply to Choice of two algorithms by Charlie)

We can improve on this using the fact that 12^6 = 1 mod 7. As a result, we can swap the nth and n+6th digits of any solution to arrive at another solution.  That's because A*12^(n+6) + B*12^n = 12^n(A*12^6 + B) = 12^n(A+B) mod 7 which is symmetric in A and B.

So we can use Charlie's approach of enumerating the pandigitals, but we can immediately skip any where the ith digit is bigger than the i+6th digit, greatly reducing how many numbers we have to compute divisibility for.

For each of these solutions, there will be a set of 2^6 = 64 total solutions, where in each case you can pick whether the ith and i+6th digits should be in ascending or descending order.

  Posted by Paul on 2016-09-13 19:01:57
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information