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

Home > Numbers
Happy New Year (Posted on 2011-01-01) Difficulty: 3 of 5

2011=670*3+1+2+4+8-9-5

We have just welcomed the New Year, using all 10 digits and 4 basic arithmetic signs(+, -, /, and *).

Try to get 2011 with ALL 10 digits, significantly fewer signs and no brackets.

Hint: My solution uses 10 distinct digits and 3 signs only, but maybe a better solution exists.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re(5): best I can do -- the program for the solutions | Comment 6 of 9 |
(In reply to re(4): best I can do -- computer solutions involving division by Charlie)

The solutions were filtered from the output of:

   10   V$="0123456789":H$=V$
   11   kill "2011b.txt":open "2011b.txt" for output as #2
   15   repeat
   20    gosub *Permute(&V$)
   30    for pos1=1 to 8
   40      n1s=left(v$,pos1):rest1s=mid(v$,pos1+1,*)
   41      if left(n1s,1)="0" then goto 770
   50      n1=val(n1s)
   55      for pos2=1 to len(rest1s)
   56        n2s=left(rest1s,pos2):n3s=mid(rest1s,pos2+1,*)
   57        if left(n2s,1)="0" then goto 280
   58        if left(n3s,1)="0" then goto 280
   59        n2=val(n2s):n3=val(n3s):flag=""
   60        for op1=1 to 4
   65          result=0
   70          if op1=1 then
   80            :result=n1+n2
   90          :elseif op1=2 then
  100            :result=n1-n2
  110          :elseif op1=3 then
  120            :result=n1*n2
  130          :elseif op1=4 and n2<>0 then
  140            :result=n1//n2
  141          :elseif op1=4 and n2=0 then
  142            :flag="bad"
  150          :endif
  160          for op2=1 to 4
  170             if op2=1 then
  180               :result2=result+n3:if result2 = 2011 then print n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:print#2, n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:endif
  190             :elseif op2=2 then
  200               :result2=result-n3:if result2 = 2011 then print n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:print#2, n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:endif
  210             :elseif op2=3 then
  220               :result2=result*n3:if result2 = 2011 then print n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:print#2, n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:endif
  230             :elseif op2=4 and n3<>0 then
  240               :result2=result//n3:if result2 = 2011 then print n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:print#2, n1;mid("+-*/",op1);n2;mid("+-*/",op2);n3;flag:endif
  241             :elseif op2=4 and n3=0 then
  242               :flag="bad"
  250             :endif
  260          next op2
  270        next op1
  280      next pos2
  770    next pos1
  785   until V$=H$
  790   close 2:end
  800 

Edited on January 1, 2011, 2:47 pm
  Posted by Charlie on 2011-01-01 14:47:25

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