Consider numbers like
343 or
2592.
343=(3+4)^3
2592=2^5*9^2.
We have just shown that some numbers stay unchanged when a number of mathematical operators are added /inserted, without changing the order of the digits.
Within our puzzle lets call those numbers expressionist numbers.
Let us limit the set of acceptable mathematical symbols to the following operators:
+, -, *, /, ^, sqrt, !. and any amount of brackets.
My questions:
In the
period between 10 A.D. & 2016 A.D. what years were labeled by expressionist numbers?
How many such years will there be between 2017 A.D. & 9999 A.D.?
Bonus: How about one, two (or more) 5-digit examples?
(In reply to
Computer "solution" part 1 -- no guarantee of completeness by Charlie)
I count 188 cases below for part 2:
2048 2r0!4!+^8r/ sqrt(2)^(0!+4!)/sqrt(8)
2160 21+6!* (2+1)*6! should have +0 (0+ in RPN)
2161 21+6!*1+ (2+1)*6!+1
2162 21+6!*2+ (2+1)*6!+2
2163 21+6!*3+ (2+1)*6!+3
2164 21+6!*4+ (2+1)*6!+4
2165 21+6!*5+ (2+1)*6!+5
2166 21+6!*6+ (2+1)*6!+6
2167 21+6!*7+ (2+1)*6!+7
2168 21+6!*8+ (2+1)*6!+8
2169 21+6!+9r* (2+1+6!)*sqrt(9)
2187 21+r8^rr7^ sqrt(sqrt(sqrt((2+1))^8))^7
2304 2r30!+!r*4^ (sqrt(2)*sqrt((3+0!)!))^4
2520 25+!2/ (2+5)!/2 should have +0 (0+ in RPN)
2521 25+!2/1+ (2+5)!/2+1
2522 25+!2/2+ (2+5)!/2+2
2523 25+!2/3+ (2+5)!/2+3
2524 25+!2/4+ (2+5)!/2+4
2525 25+!2/5+ (2+5)!/2+5
2526 25+!2/6+ (2+5)!/2+6
2527 25+!2/7+ (2+5)!/2+7
2528 25+!2/8+ (2+5)!/2+8
2529 25+!2/9+ (2+5)!/2+9
2544 25+!4r/4!+ (2+5)!/sqrt(4)+4!
2592 2r5^9*2^ (sqrt(2)^5*9)^2
2737 2r7r*3!^7- (sqrt(2)*sqrt(7))^3!-7
2742 2r7r*r4!^r2- sqrt(sqrt((sqrt(2)*sqrt(7)))^4!)-2
2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!5*9r!+8- 3!!*5+sqrt(9)!-8
3599 3!!5*9rr9rr-!-3!!*5-(sqrt(sqrt(9))-sqrt(sqrt(9)))!
3600 3!!60!-* 3!!*(6-0!)
3601 3!!60!-*1+ 3!!*(6-0!)+1
3602 3!!60!-*2+ 3!!*(6-0!)+2
3603 3!!60!-*3+ 3!!*(6-0!)+3
3604 3!!6!0!+4*+ 3!!+(6!+0!)*4
3605 3!!r6!r*0!+5* (sqrt(3!!)*sqrt(6!)+0!)*5
3606 3!!60!-*6+ 3!!*(6-0!)+6
3607 3!!60!-*7+ 3!!*(6-0!)+7
3608 3!!60!-*8+ 3!!*(6-0!)+8
3609 3!!60!-*9+ 3!!*(6-0!)+9
3615 36!+1*5* (3+6!)*1*5
3625 36!+2+5* (3+6!+2)*5
3630 3!!6+3!0!-* (3!!+6)*(3!-0!)
3636 3!!6+3!*6!- (3!!+6)*3!-6!
3645 3r6r^4!r^5* sqrt(3)^sqrt(6)^sqrt(4!)*5
3654 3!!6+5*4!+ (3!!+6)*5+4!
3655 3!!6+5+5* (3!!+6+5)*5
3685 36^8+5* (3^6+8)*5
3755 3!!7+5*5!+ (3!!+7)*5+5!
3780 3!7!*8/ 3!*7!/8 should have +0 (0+ in RPN)
3781 3!7!*8/1+ 3!*7!/8+1
3782 3!7!*8/2+ 3!*7!/8+2
3783 3!7!*8/3+ 3!*7!/8+3
3784 3!7!*8/4+ 3!*7!/8+4
3785 3!7!*8/5+ 3!*7!/8+5
3786 3!7!*8/6+ 3!*7!/8+6
3787 3!7!*8/7+ 3!*7!/8+7
3788 3!7!*8/8+ 3!*7!/8+8
3789 3!7!*8/9+ 3!*7!/8+9
At this point the maximum depth was changed to 16 to speed the process, which was slowing down considerably.
The previous solutions did not need more than that anyway.
The conversions below were made with the RPN to Algebraic conversion program.
3972 397*2^+ 3+(9*7)^2
3996 3!!9r!9*-6* (3!!-sqrt(9)!*9)*6
4032 4!0!3!+r*2^ (4!*sqrt((0!+3!)))^2
4088 40!8+r!^8- 4^sqrt((0!+8))!-8
4093 4rr0!9r+!^3- sqrt(sqrt(4))^(0!+sqrt(9))!-3
4094 4rr0!9r+!^4r- sqrt(sqrt(4))^(0!+sqrt(9))!-sqrt(4)
4096 4rr0!9r+!^ sqrt(sqrt(4))^(0!+sqrt(9))!
4098 4r0!9-8^r+ sqrt(4)+sqrt((0!-9)^8)
4099 4rr0!9r+!^9r+ sqrt(sqrt(4))^(0!+sqrt(9))!+sqrt(9)
4314 4!3!!1-*4/ 4!*(3!!-1)/4
4316 4r3!!1-6*+ sqrt(4)+(3!!-1)*6
4319 43+!1-9r!!- (4+3)!-1-sqrt(9)!!
4320 4r3!!*20!+* sqrt(4)*3!!*(2+0!)
4324 43!!24+*+ 4+3!!*(2+4)
4330 43!3!!0!+*+ 4+3!*(3!!+0!)
4331 4r3!!+3!*1- (sqrt(4)+3!!)*3!-1
4332 4r3!!+r3!r*2^ (sqrt((sqrt(4)+3!!))*sqrt(3!))^2
4334 4r3!!+3!*4r+ (sqrt(4)+3!!)*3!+sqrt(4)
4337 4!3!!3!*+7- 4!+3!!*3!-7
4344 4!3!!*4/4!+ 4!*3!!/4+4!
4346 4r3!!4+6*+ sqrt(4)+(3!!+4)*6
4368 4r3*6!8+* sqrt(4)*3*(6!+8)
4372 4r37^*2- sqrt(4)*3^7-2
4374 4rr3r7^*r4^ sqrt((sqrt(sqrt(4))*sqrt(3)^7))^4
4464 4r4+6!4!+* (sqrt(4)+4)*(6!+4!)
4466 4r4!6!+6*+ sqrt(4)+(4!+6!)*6
4480 4r4*!80!+/ (sqrt(4)*4)!/(8+0!)
4608 4!r6^0!8+r/ sqrt(4!)^6/sqrt((0!+8))
4816 481+r!^6!+ 4^sqrt((8+1))!+6!
4896 4!rr8^9r!!6*+ sqrt(sqrt(4!))^8+sqrt(9)!!*6
4913 4r9*1-r3!^ sqrt((sqrt(4)*9-1))^3!
4944 49r+!4!4*- (4+sqrt(9))!-4!*4
4995 49r+!95*- (4+sqrt(9))!-9*5
5035 5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4r*7!+5- 6!*sqrt(4)+7!-5
6476 6!4-7!+6!+ 6!-4+7!+6!
6480 6rr4^!80!+* sqrt(sqrt(6))^4!*(8+0!)
6494 6!4r+9*4- (6!+sqrt(4))*9-4
6495 64^9r+5* (6^4+sqrt(9))*5
6498 6!4r+rr9rr*r8^ sqrt((sqrt(sqrt((6!+sqrt(4))))*sqrt(sqrt(9))))^8
6696 6r6^96!*+ sqrt(6)^6+9*6!
6768 67!6/+8* (6+7!/6)*8
6835 6!8!+3!/5- (6!+8!)/3!-5
6839 6!8!+3!-9r!/ (6!+8!-3!)/sqrt(9)!
6840 6!8!+4r0!+!/ (6!+8!)/(sqrt(4)+0!)!
6859 68+5+r9r!^ sqrt((6+8+5))^sqrt(9)!
6864 6!8!+6/4!+ (6!+8!)/6+4!
7056 70!-5^6!- (7-0!)^5-6!
7199 7!1-9r!!9r*+ 7!-1+sqrt(9)!!*sqrt(9)
7235 723!!*+5* (7+2*3!!)*5
7344 7!3r4*4^+ 7!+(sqrt(3)*4)^4
7595 75!9*5+* 7*(5!*9+5)
7927 792+!7!/+ 7+(9+2)!/7!
7944 7!9r!!4*+4!+ 7!+sqrt(9)!!*4+4!
8057 8!0!*5/7- 8!*0!/5-7
8064 8!0!6rr^4!+r/ 8!/sqrt((0!^sqrt(sqrt(6))+4!))
8065 8!0!-6+5/ (8!-0!+6)/5
8192 8r1*9^2r/ (sqrt(8)*1)^9/sqrt(2)
8397 8!3/9r-7!- 8!/3-sqrt(9)-7!
8405 8!4!/0!+5* (8!/4!+0!)*5
8644 86!4!*+4r/ (8+6!*4!)/sqrt(4)
8648 86!48+*+ 8+6!*(4+8)
8974 8!9/7+4r* (8!/9+7)*sqrt(4)
9360 9r!!3!*60!+!+ sqrt(9)!!*3!+(6+0!)!
9595 9r!!5!*9/5- sqrt(9)!!*5!/9-5
9599 9r!!5!*9-9/ (sqrt(9)!!*5!-9)/9
Bonus:
10074 10!+0!7!+4-* (1+0!)*(0!+7!-4)
10075 10!+0!*7!*5- (1+0!)*0!*7!-5
10076 10!+0!7!+*6- (1+0!)*(0!+7!)-6
10079 10!+0!7!+*9r- (1+0!)*(0!+7!)-sqrt(9)
10080 10!+0!*80!-!* (1+0!)*0!*(8-0!)!
10081 10!0!+81-!*+ 1+(0!+0!)*(8-1)!
10082 10!0!8+r!+!+2* (1+(0!+(sqrt(0!+8))!)!)*2
10368 10!+r3!^rr6*r8^ (sqrt((sqrt(sqrt(sqrt(1+0!))^(3!)))*6))^8
RPN2ALGB.BAS:
DECLARE SUB checkParen (s$, ops$)
OPEN "rpn.TXT" FOR INPUT AS #1
OPEN "algbrc.TXT" FOR OUTPUT AS #2
DIM stack$(25)
DO
LINE INPUT #1, l$
stackLevel = 0
bld$ = ""
FOR i = 1 TO LEN(l$)
c$ = MID$(l$, i, 1)
ix = INSTR("0123456789", c$)
IF ix THEN
stackLevel = stackLevel + 1
stack$(stackLevel) = c$
ELSE
IF stkRaise THEN
stackLevel = stackLevel + 1
stack$(stackLevel) = bld$
stkRaise = 0
bld$ = ""
END IF
SELECT CASE c$
CASE "+"
stackLevel = stackLevel - 1
stack$(stackLevel) = stack$(stackLevel) + "+" + stack$(stackLevel + 1)
CASE "-"
h2$ = stack$(stackLevel)
checkParen h2$, "+-"
stackLevel = stackLevel - 1
h1$ = stack$(stackLevel)
stack$(stackLevel) = h1$ + "-" + h2$
CASE "*"
h2$ = stack$(stackLevel)
checkParen h2$, "+-"
stackLevel = stackLevel - 1
h1$ = stack$(stackLevel)
checkParen h1$, "+-/"
stack$(stackLevel) = h1$ + "*" + h2$
CASE "/"
h2$ = stack$(stackLevel)
checkParen h2$, "+-/*"
stackLevel = stackLevel - 1
h1$ = stack$(stackLevel)
checkParen h1$, "+-/"
stack$(stackLevel) = h1$ + "/" + h2$
CASE "^"
h2$ = stack$(stackLevel)
checkParen h2$, "+-*/"
stackLevel = stackLevel - 1
h1$ = stack$(stackLevel)
checkParen h1$, "+-*/"
stack$(stackLevel) = h1$ + "^" + h2$
CASE "!"
h2$ = stack$(stackLevel)
checkParen h2$, "+-*/"
stack$(stackLevel) = h2$ + c$
CASE "r"
h2$ = stack$(stackLevel)
checkParen h2$, "+-*/"
stack$(stackLevel) = "sqrt(" + h2$ + ")"
END SELECT
END IF
NEXT
IF stackLevel <> 1 THEN
REM
END IF
PRINT l$, stack$(1): PRINT #2, l$, stack$(1)
LOOP UNTIL EOF(1)
CLOSE
SUB checkParen (s$, ops$)
pLevel = 0
flag = 0
FOR i = 1 TO LEN(s$)
SELECT CASE MID$(s$, i, 1)
CASE "("
pLevel = pLevel + 1
CASE ")"
pLevel = pLevel - 1
CASE ELSE
IF pLevel = 0 AND INSTR(ops$, MID$(s$, i, 1)) THEN flag = 1: EXIT FOR
END SELECT
NEXT i
IF flag THEN s$ = "(" + s$ + ")"
END SUB
Edited on May 31, 2016, 7:33 am
Edited on May 31, 2016, 7:34 am
|
Posted by Charlie
on 2016-05-31 07:31:18 |