>1. What's the next higher number that follows this pattern:
>1^1 + 3^2 + 3^3 = 135
That should have been:
1^1 + 3^2 + 5^3 = 135
This isn't recursive, or dot syntaxy, but it's brief (and I did it
quicker than I was expecting):
on sumthing
repeat with a = 1 to 10000
v = string(a)
t = 0
repeat with b = 1 to the number of chars in v
t = t + power(value(char b of v),b)
end repeat
if t = a then put a
end repeat
end
sumthing
-- 1
-- 2
-- 3
-- 4
-- 5
-- 6
-- 7
-- 8
-- 9
-- 89
-- 135
-- 175
-- 518
-- 598
-- 1306
-- 1676
-- 2427
I tried it at 100,000 too, and it seems that 2427 is the higher
number that works. Oh, 175 was the answer to the question.
I'll ponder the second question now.
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]