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

Home > Just Math
Casting Out Zeros (Posted on 2013-07-25) Difficulty: 4 of 5
One may perform the following two operations on a natural number:

1.Multiply it by any natural number
2.Delete zeros in its decimal representation.

For any natural number n, can one perform a sequence of these operations that will transform n to a one-digit number?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re: Godel strikes again --- 31 and 33 | Comment 2 of 4 |
(In reply to Godel strikes again by Steve Herman)

? 31

mult     prod   w/o zeros
 97      3007    37
 11      407     47
 64      3008    38
 55      2090    29
 69      2001    21
 48      1008    18
 5       90      9

? 33
 31      1023    123
 82      10086   186
 54      10044   144
 75      10800   18
 5       90      9

from

   10     N0=1
   20     while N0>0
   30       input N0
   40       if N0=0 then end
   50       N=N0:Pn=0
   60       while N>9 and N<>Pn
   65          Pn=N
   70         Max0=-1:Besti=1:Bestprod=N
   80         for I=1 to 99
   90            Prod=N*I
  100            Z=fnCtzero(Prod)
  110            if Z>Max0 and I @ 10<>0 and fnNozero(Prod)<>N then Max0=Z:Besti=I:Bestprod=Prod
  120         next I
  130         N=fnNozero(Bestprod)
  140         print Besti,Bestprod,N
  150       wend
  160     wend
  170   
  180     fnCtzero(Num)
  190        local Ct,I,Ns
  200        Ns=str(Num)
  210        Ct=0
  220        for I=1 to len(Ns)
  230          if mid(Ns,I,1)="0" then inc Ct
  240        next
  250     return(Ct)
  260   
  270     fnNozero(Num)
  280        local Ns,N,I
  290        Ns=cutspc(str(Num))
  300        N=0
  310        for I=1 to len(Ns)
  320          if mid(Ns,I,1)>"0" then N=10*N+val(mid(Ns,I,1))
  330        next
  340     return(N)


  Posted by Charlie on 2013-07-26 09:53: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 (2)
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