Much was said about 1729 a.k.a. Ramanujan number.or a taxicab number.
1729 is also a Carmichael number and the first absolute Euler pseudoprime, a sphenic number, a Zeisel number etc etc
Please note the following (and solve):
1. 1729 is one of four positive integers (with the others being A, B and the trivial case 1) which, when its digits are added together, produces a sum which, when multiplied by its reversal, yields the original number:
1 + 7 + 2 + 9 = 19 ; 19*91 = 1729
Find A and B.
2. 1729= xyz, where x,y and z are integer members of an arithmetic progression.
Find these members.
3. 1729 can be expressed (in more than one way) as a sum of distinct Fibonacci numbers
List all the expressions.
As Jer has said, part 2 is simple, so programs are only for parts 1 and 3.
DECLARE SUB addon (wh#)
CLEAR , , 25000
DEFDBL A-Z
DIM SHARED sum
CLS
FOR sum = 2 TO 99999
s$ = LTRIM$(STR$(sum))
r$ = ""
FOR i = 1 TO LEN(s$)
r$ = MID$(s$, i, 1) + r$
NEXT
rev = VAL(r$)
prod = sum * rev
p$ = LTRIM$(STR$(prod))
sum2 = 0
FOR i = 1 TO LEN(p$)
sum2 = sum2 + VAL(MID$(p$, i, 1))
NEXT
IF sum = sum2 THEN
PRINT sum; rev; prod
END IF
NEXT
PRINT : PRINT
part3:
DIM SHARED fib(20), hs(20), sumto(20)
fib(0) = 1: fib(1) = 1
FOR i = 2 TO 20
fib(i) = fib(i - 2) + fib(i - 1)
IF fib(i) > 1729 THEN EXIT FOR
NEXT: PRINT
maxsub = i - 1
sum = 0: leastStart = 0
FOR i = 1 TO maxsub
sum = sum + fib(i): sumto(i) = sum
IF sum > 1729 AND leastStart = 0 THEN leastStart = i - 1
NEXT
FOR st = leastStart TO maxsub
hs(1) = st: sum = fib(st)
addon 2
NEXT
SUB addon (wh)
newstart = hs(wh - 1) - 1
FOR try = newstart TO 1 STEP -1
IF sum + sumto(try) < 1729 THEN EXIT FOR
hs(wh) = try
sum = sum + fib(try)
IF sum = 1729 THEN
FOR i = 1 TO wh
PRINT fib(hs(i));
NEXT
PRINT
ELSE
IF sum < 1729 THEN
addon wh + 1
END IF
END IF
sum = sum - fib(try)
NEXT
END SUB
The results for parts 1 and 3 are shown as:
9 9 81
18 81 1458
19 91 1729
987 610 89 34 8 1
987 610 89 34 5 3 1
987 610 89 21 13 8 1
987 610 89 21 13 5 3 1
987 610 55 34 21 13 8 1
987 610 55 34 21 13 5 3 1
987 377 233 89 34 8 1
987 377 233 89 34 5 3 1
987 377 233 89 21 13 8 1
987 377 233 89 21 13 5 3 1
987 377 233 55 34 21 13 8 1
987 377 233 55 34 21 13 5 3 1
987 377 144 89 55 34 21 13 8 1
987 377 144 89 55 34 21 13 5 3 1
1597 89 34 8 1
1597 89 34 5 3 1
1597 89 21 13 8 1
1597 89 21 13 5 3 1
1597 55 34 21 13 8 1
1597 55 34 21 13 5 3 1
So for part 1, other than 1, the numbers are 81, 1458 and 1729, and for part 3 the addends are shown above.
|
Posted by Charlie
on 2012-01-04 13:09:53 |