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

Home > Numbers
Divisible by Length (Posted on 2024-04-27) Difficulty: 3 of 5
Determine the largest integer A such that for K=1,2,3,...,length(A) the first K digits of A form an integer divisible by K.
For example, for 56165, 5 is divisible by 1, 56 is divisible by 2, 561 is divisible by 3, 5616 is divisible by 4 and 56165 is divisible by 5.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 6
global mx 
digs=''; mx=10;
addon(digs)

function addon(d)
  global mx 
  for newdig=0:9
    nn=sym([d num2str(newdig)]);
    if mod(nn,length(d)+1)==0 && nn~=0
      if length(d)>mx 
        disp(nn)
        mx=length(d);
      end
      addon([d num2str(newdig)])
    end
  end
end

finds increasing lengths:

>> divisibleByLength
102006162060
1020061620604
10200616206046
102006162060465
1020061620604656
10200616206046568
108054801036000018
1080548010360000180
10805480103600001800
123606009012225672009
1236060090122256720090
12360600901222567200901
144408645048225636603816
3608528850368400786036725

The longest is 25 digits long. However there may be others that long, so I'll rerun with >= mx instead of > mx.

With >= it still finds only one of length 25:

12360600901222567200901
14440864504822563660381
144408645048225636603816
360852885036840078603672
3608528850368400786036725
>> 

BTW 36085288503684007860367250 mod 26 is 12, and we can't replace that zero at the end with a digit worth 14.

3608528850368400786036725 is the largest such integer.

Edited on April 27, 2024, 2:31 pm
  Posted by Charlie on 2024-04-27 14:22:07

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 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information