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

 ProSum Numbers (Posted on 2015-01-28)
ProSum Numbers are obtained when the product of an integer's digits divided by the sum of its digits is itself an integer. If the resultant integer can be used to produce yet another integer in the same way, a sequence is formed. It is terminated when a new term is less than 10. The first term must be at least 10, or an endless loop is formed.

Find the lowest starting term for a sequence of two ProSum Numbers, then do the same for three terms and four terms.

 No Solution Yet Submitted by Danish Ahmed Khan No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(2): computer solution -- corrected program | Comment 4 of 5 |
(In reply to re: computer solution by Jer)

DECLARE FUNCTION pod# (x#)
DECLARE FUNCTION sod# (x#)
DEFDBL A-Z
DIM r(10), found(10, 10)
CLS

FOR i = 10 TO 9999999
n = i
ct = 0
DO
ct2 = 0
flag\$ = ""
s = sod(n)
nsave = n
n = pod(n)
IF n MOD s = 0 AND n > 0 THEN
ct = ct + 1
r(ct) = nsave
IF n < 10 THEN EXIT DO
n = n / s
IF s = 1 THEN EXIT DO
ELSE
EXIT DO
END IF
LOOP
IF found(ct, 0) = 0 THEN
found(ct, 0) = i
PRINT i, ct
FOR j = 1 TO ct
found(ct, j) = r(j)
PRINT "     "; r(j)
NEXT
PRINT flag\$
END IF

NEXT i

'
FUNCTION pod (x)
ns\$ = LTRIM\$(STR\$(x))
prod = 1
FOR i = 1 TO LEN(ns\$)
prod = prod * VAL(MID\$(ns\$, i, 1))
NEXT
pod = prod
END FUNCTION

FUNCTION sod (x)
ns\$ = LTRIM\$(STR\$(x))
sum = 0
FOR i = 1 TO LEN(ns\$)
sum = sum + VAL(MID\$(ns\$, i, 1))
NEXT
sod = sum
END FUNCTION

does find the sequence 3489, 36, 2.

It must be pretty far ahead to find a 4-sequence.

 Posted by Charlie on 2015-01-28 13:38:55

 Search: Search body:
Forums (0)