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

Home > Numbers
Seven - with and without (Posted on 2013-08-09) Difficulty: 2 of 5
Let us divide a set of all n-digit numbers into two subsets:
N7- whose members contain at least one 7 and Nw - whose members are 7-free ,e.g. for n=2 there are 18 members in N7: 17,27,37,... 70, 71,72, 79, and there are 72 members in Nw.
Let us denote those quantities by q7 and qw: q7(2)=18 and qw(2)=72.

Evaluate q7(n) and qw(n) for the following values of n:

n=5
n=42
n=100

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 3 of 6 |

For any given n, there are 8 choices for the first digit (any digit except 0 or 7) of members of Nw, and 9 choices for each succeeding digit: qw(n) = 8 * 9^(n-1).

Since the total number of n-digit numbers is 9 * 10^(n-1), q7(n) = 9 * 10^(n-1) - 8 * 9^(n-1).

Constructing a table:

10      for I=1 to 30
20        print I,9*10^(I-1)-8*9^(I-1);8*9^(I-1)
30      next
40      for I=42 to 100 step 58
50        print I,9*10^(I-1)-8*9^(I-1);8*9^(I-1)
60      next

gives us

n q7(n) qw(n)

1  1  8
2  18  72
3  252  648
4  3168  5832
5  37512  52488
6  427608  472392
7  4748472  4251528
8  51736248  38263752
9  555626232  344373768
10 5900636088  3099363912
11 62105724792  27894275208
12 648951523128  251048476872
13 6740563708152  2259436291848
14 69665073373368  20334926626632
15 716985660360312  183014339639688
16 7352870943242808  1647129056757192
17 75175838489185272  14824161510814728
18 766582546402667448  133417453597332552
19 7799242917624007032  1200757082375992968
20 79193186258616063288  10806813741383936712
21 802738676327544569592  97261323672455430408
22 8124648086947901126328  875351913052098873672
23 82121832782531110136952  7878167217468889863048
24 829096495042779991232568  70903504957220008767432
25 8361868455385019921093112  638131544614980078906888
26 84256816098465179289838008  5743183901534820710161992
27 848311344886186613608542072  51688655113813386391457928
28 8534802103975679522476878648 465197896024320477523121352
29 85813218935781115702291907832  4186781064218884297708092168
30 862318970422030041320627170488  37681029577969958679372829512
...
42 889357764282167093521242008865140402572728
                                    10642235717832906478757991134859597427272
...                                   
100 8999763898676554777982809972158190418109485125819863649336911488922898584452532175837338324711960888
           236101323445222017190027841809581890514874180136350663088511077101415547467824162661675288039112
           
7-digit numbers are the first where there are more numbers with 7 than without.           


  Posted by Charlie on 2013-08-09 12:53:08
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 (3)
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