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

Home > Numbers
Recipropandigital (Posted on 2025-04-16) Difficulty: 3 of 5
What is the smallest positive integer whose reciprocal contains all 10 digits in the ten consecutive digits starting with the first nonzero digit?

a) smallest when truncated (whether rounding gives same result or not)
b) smallest when rounded (whether truncation gives same result or not)
c) smallest when truncation and rounding give the same result

Note: some algorithms round numbers with a fractional part of exactly 0.5 to the nearest even integer, but for this exercise, 0.5 is always rounded up.

See The Solution Submitted by Larry    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
The first fifteen that qualify using truncation are:

     n     reciprocal    tested sequence

    648 0.001543209876543  1543209876
   6480 0.000154320987654  1543209876
   6532 0.000153092467851  1530924678
  17229 0.000058041673922  5804167392
  25235 0.000039627501486  3962750148
  26847 0.000037248109658  3724810965
  31264 0.000031985670420  3198567042
  32712 0.000030569821472  3056982147
  37257 0.000026840593714  2684059371
  38250 0.000026143790850  2614379085
  40502 0.000024690138759  2469013875
  42626 0.000023459860179  2345986017
  43177 0.000023160478959  2316047895
  45894 0.000021789340655  2178934065
  50625 0.000019753086420  1975308642
  
  
The first fifteen that qualify using rounding are:  
 
   1608 0.000621890547264  6218905473
   1637 0.000610873549175  6108735492
   2025 0.000493827160494  4938271605
   3825 0.000261437908497  2614379085
  10125 0.000098765432099  9876543210
  11722 0.000085309674117  8530967412
  16080 0.000062189054726  6218905473
  16370 0.000061087354918  6108735492
  17229 0.000058041673922  5804167392
  20250 0.000049382716049  4938271605
  20717 0.000048269537095  4826953710
  28188 0.000035476089116  3547608912
  28834 0.000034681279046  3468127905
  31264 0.000031985670420  3198567042
  31492 0.000031754096278  3175409628
  
17229 is the smallest integer that qualifies both ways, as its reciprocal, 0.000058041673922  has the digits '5804167392' either way as the next digit is only 2 and does not cause the rounding to affect what comes before.

clearvars,clc
ct=0;
for n=5:90000
  r=1/n;
  s=strrep(sprintf('%17.15f',r), '0.', '');
  tst= num2str(str2num(s))  ;
  if length(tst)>9
    t=tst(1:10);
    if length(unique(t))==10
      fprintf('%7d %17.15f  %s\n',n, r, t)
      ct=ct+1;
      if ct==15
        break
      end
    end
  end
end

clearvars 
disp(' ')

ct=0;
for n=5:90000
  r=1/n;
  s=strrep(sprintf('%17.15f',r), '0.', '');
  tst= num2str(str2num(s))  ;
  if length(tst)>9
    t=num2str(str2num(tst(1:11))+5);
    t=t(1:10);
    if length(unique(t))==10
      fprintf('%7d %17.15f  %s\n',n, r, t)
      ct=ct+1;
      if ct==15
        break
      end
    end
  end
end

  Posted by Charlie on 2025-04-16 14:40:10
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 (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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