I have 3 versions, tested on the HP 50G
solution = 381654729
First solution
Code:
« { 1 0 0 0 0 0 0 0 0 } 121252121 2 9
FOR I
IF I 1 ==
THEN 2 'I' STO 8 ALOG / IP SWAP DROP DUP 8 ALOG * 121252121 + { 0 0 0 0 0 0 0 0 0 } ROT 1 + 1 PUT SWAP
END DUP 9 I - ALOG / IP DUP I MOD OVER 10 / FP 10 * 5 PICK SWAP GET OR
IF
THEN 10 / FP .9 ==
IF
THEN 9 I - ALOG 8 * - I 2 - 'I' STO DUP 8 I - ALOG / IP 10 / FP 10 * ROT OVER 0 PUT UNROT
IF 9 ==
THEN 8 I - ALOG 8 * - I 1 - 'I' STO
END
IF I
THEN DUP 8 I - ALOG / IP 10 / FP 10 * ROT SWAP 0 PUT SWAP 8 I - ALOG +
END
ELSE 9 I - ALOG + I 1 - 'I' STO
END
ELSE 10 / FP 10 * ROT SWAP 1 PUT SWAP
END
NEXT SWAP DROP
»
617.5 Bytes
Second solution using user flags
Code:
« RCLF 2 #1 PUT STOF 121252121 2 9
FOR I
IF I 1 ==
THEN 2 'I' STO 8 ALOG / IP DUP 8 ALOG * 121252121 + RCLF 2 #0 PUT STOF SWAP 1 + SF
END DUP 9 I - ALOG / IP DUP I MOD OVER 10 / FP 10 * FS? OR
IF
THEN 10 / FP .9 ==
IF
THEN 9 I - ALOG 8 * - I 2 - 'I' STO DUP 8 I - ALOG / IP 10 / FP 10 * DUP CF
IF 9 ==
THEN 8 I - ALOG 8 * - I 1 - 'I' STO
END
IF I
THEN DUP 8 I - ALOG / IP 10 / FP 10 * CF 8 I - ALOG +
END
ELSE 9 I - ALOG + I 1 - 'I' STO
END
ELSE 10 / FP 10 * SF
END
NEXT
»
558.5 Bytes
Third solution using the user flags, restoring it at the end of the program
Code:
« RCLF DUP 2 #1 PUT STOF 121252121 2 9
FOR I
IF I 1 ==
THEN 2 'I' STO 8 ALOG / IP DUP 8 ALOG * 121252121 + RCLF 2 #0 PUT STOF SWAP 1 + SF
END DUP 9 I - ALOG / IP DUP I MOD OVER 10 / FP 10 * FS? OR
IF
THEN 10 / FP .9 ==
IF
THEN 9 I - ALOG 8 * - I 2 - 'I' STO DUP 8 I - ALOG / IP 10 / FP 10 * DUP CF
IF 9 ==
THEN 8 I - ALOG 8 * - I 1 - 'I' STO
END
IF I
THEN DUP 8 I - ALOG / IP 10 / FP 10 * CF 8 I - ALOG +
END
ELSE 9 I - ALOG + I 1 - 'I' STO
END
ELSE 10 / FP 10 * SF
END
NEXT SWAP STOF
»
566 Bytes