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

Home > Numbers
Erased to a multiple of 7 (Posted on 2021-04-21) Difficulty: 2 of 5
Given the number 188188...188 (number 188 is written 101 times). Some digits of this number are crossed out. What is the largest multiple of 7, that could happen?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 5 |
At first I tried a very much simpler version of the program below, trying each of the 303 possibilities of deleting just one digit. None was divisible by 7. A program similar to the one below, but not also deleting the first digit, tested every possibility of deleting two digits.

On a hunch I tried deleting the first digit and the last two digits. That was divisible by 7. That led to the below program, which varied which two others besides the first were divisible by 7. Indeed deleting the first three 1's works and gives the largest number available from deleting three digits, and it is divisible by 7, and that is the answer.

Playing around with intermediate values led me to the same conclusion as tomarken: no matter which three digits you remove, the result is divisible by 7.


a=repmat('188',101);
a=a(1,:);
digits 1000
syms n mx
n=mod(vpa(a),vpa(7))
pwr=1;
mx=0;
pmx=0; pmx2=0;
for p=2:302  
  for p2=p+1:303 
   b=a;
   b(p2)=[];
   b(p)=[];
   b(1)=[];
   n=mod(vpa(b),vpa(7));
   if n==0
      if b>=mx
         mx=b;
         pmx=p; pmx2=p2;
         disp([1 pmx pmx2])
      end
   end
  end 
end
disp([pmx pmx2])
disp(mx)

>> erasedToMultOf7
n =
6.0                  remainder from original number div by 7
     1     2     3       |
     1     2     4       |
     1     3     4       |  intermediate maxima
     1     4     5       |
     1     4     6       |
     1     4     7   final maximum found removing these positions  
     4     7    positions removed other than first
8888881881881881881881881881881881881881881881881881881881881881
8818818818818818818818818818818818818818818818818818818818818818
8188188188188188188188188188188188188188188188188188188188188188
1881881881881881881881881881881881881881881881881881881881881881
88188188188188188188188188188188188188188188
>> 

  Posted by Charlie on 2021-04-21 10:39:46
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