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

Home > Numbers
7 somewhere (Posted on 2022-08-12) Difficulty: 4 of 5
Prove: If x is a positive real number, then somewhere in the infinite sequence {x, 2x, 3x, ...} there is a number containing the digit 7.

If x is a positive real number, then somewhere in the finite sequence {x, 2x, 3x, ..., nx} there is a number containing the digit 7. Find the minimum value of n.

Note: Some numbers can be written in two ways (1.8=1.7999999...) only consider the form without all the 9's.

Source: Slightly adapted from a post by Victor Wang on Facebook.

No Solution Yet Submitted by Jer    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 6 of 16 |
mx=0;
for i=100000:999999
  for n=1:200
    ni=char(string(n*i));
    ix=find(ni=='7');
    if ~isempty(ix)
      if n>mx
        mx=n;
        disp([n i n*i])
      end
      break
    end
  end
  if n>=200
    disp('raise limit on n')
    break
  end
end

  n   first 6 digits   product
  
  7      100000         700000
 11      116000        1276000
 12      116480        1397760
 15      116500        1747500
 33      166000        5478000
 35      200000        7000000


finds the highest n that is necessary to obtain a 7 is 35, for any real number whose first six significant digits are anywhere from 100000 to 999999. In particular n=35 is necessary for real numbers starting with 2 and having all zeros after that: 2.00000... * 10^k.

Of course only the first six significant digits have been tested, so I have not proved that there isn't some set of digits after that that would cause a cascade of carries that would prevent a 7 from showing up in all multiples up to a higher n, but 35 is certainly necessary, and very likely sufficient (i.e., the minimum shown to be necessary).

Increasing the digit count to eight, finds nothing higher than 35 is needed:

mx=0;
for i=1:99999999
  for n=2:35
    ni=char(string(n*i));
    ix=find(ni=='7');
    if ~isempty(ix)
      if n>mx
        mx=n;
        disp([n i])
      end
      break
    end
  end
  if n>35
    disp('raise limit on n')
    break
  end
end

That indeed 35 is necessary for 2, 20, 200..., or .00200..., etc. is shown by:

i=2;
for n=1:35
  disp([n n*i])
end

showing

     1     2
     2     4
     3     6
     4     8
     5    10
     6    12
     7    14
     8    16
     9    18
    10    20
    11    22
    12    24
    13    26
    14    28
    15    30
    16    32
    17    34
    18    36
    19    38
    20    40
    21    42
    22    44
    23    46
    24    48
    25    50
    26    52
    27    54
    28    56
    29    58
    30    60
    31    62
    32    64
    33    66
    34    68
    35    70 (the first 7 within a multiple of 2)
    
But another idea came to me. Subject every case with every possible carry into the last digit position:

clc
mx=0;
for i=100000:999999
  for n=1:100
   carryCt=0;
   for carry=0:9 
    ni=char(string(n*i));
    ix=find(ni=='7');
    if ~isempty(ix)
      carryCt=carryCt+1;
      continue
    end
   end
   if carryCt==10
     if n>mx
       mx=n;
       disp([n i n*i])
     end
     break     
   end
  end
  if n>=100
    disp('raise limit on n')
    break
  end
end

But the carries in some cases might be larger than single digit. It'll take longer, but we can speed things up by considering fewer digits now that we have the assurance that all carries will be accounted for.

clc
mx=0;
for i=1000:9999
  for n=1:100
   carryCt=0;
   for carry=0:349
    ni=char(string(n*i));
    ix=find(ni=='7');
    if ~isempty(ix)
      carryCt=carryCt+1;
      continue
    end
   end
   if carryCt==350
     if n>mx
       mx=n;
       disp([n i n*i])
     end
     break     
   end
  end
  if n>=100
    disp('raise limit on n')
    break
  end
end

gets the same results, while accounting for carries through 349.

Edited on August 12, 2022, 3:04 pm
  Posted by Charlie on 2022-08-12 15:03:15

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 (0)
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