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

Home > Numbers
Robust numbers (Posted on 2024-06-02) Difficulty: 3 of 5
An eight-digit number is said to be 'robust' if it meets both of the following conditions:

(i) None of its digits is 0.
(ii) The difference between two consecutive digits is 4 or 5.

Answer the following questions:

(a) How many robust numbers are there?
(b) A robust number is said to be 'super robust' if all of its digits are distinct. Calculate the sum of all the super robust numbers.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution: Analytical with Computer confirmation | Comment 1 of 2
The first number can be any of 9 choices.  There are always 2 choices for subsequent digits.  9 * 2^7

To form a super robust number start with any of the 9 digits, then either go up 5 or down 4 (there is always only one way to follow this instruction); or go up 4 or down 5.  So for each starting digit, there are 2 super robust numbers for a total of 18.  The average digit is 5, so the average of all super robust numbers is 55555555.

(i) There are 9*2^7 = 1152 Robust numbers
(ii)  There are 18 super robust numbers
      and their sum is 18 * 55555555 = 999999990
-------------

Program output to confirm:
1152 18
999999990
[15948372, 16273849, 26159483, 27384951, 37261594, 38495162, 48372615, 49516273, 51627384, 59483726, 61594837, 62738495, 72615948, 73849516, 83726159, 84951627, 94837261, 95162738]
This list is not in oeis.

----------------
def isrobust(n):
    """ Robust is 8 digits, no zeros, diffs all 4 or 5 """
    adjacents = ['', '56', '67', '78', '89', '19', '12', '23', '34', '45']
    s = str(n)
    if len(s) != 8:
        return False
    if '0' in s:
        return False
    for i,v in enumerate(s):
        if i == 0:
            continue
        if v not in adjacents[int(s[i-1])]:
            return False
    return True

rob = 0
sup = 0
bigsum = 0
superrobusts = []
for n in range(10000000, 100000000):
    s = str(n)
    if isrobust(n):
        rob += 1
        if len(set(s)) == len(s):
            sup += 1
            bigsum += n
            superrobusts.append(n)

print(rob, sup)
print(bigsum)
    

  Posted by Larry on 2024-06-02 13:18:30
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 (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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