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

 15-Digits and Repunit Division (Posted on 2010-01-07)
Determine all possible value(s) of a 15-digit base ten positive integer N which is constituted entirely by the digits 2 and 3, such that N is divisible by the base ten repunit R7.

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Basic solution | Comment 3 of 4 |

DECLARE SUB build ()
DEFDBL A-Z
DIM SHARED dig(15), placeVal, psn, tot

placeVal = 100000000000000#: psn = 1

build

SUB build
FOR d = 2 TO 3
dig(psn) = d
tot = tot + d * placeVal
IF psn = 15 THEN
q = INT(tot / 1111111)
totMod = tot - q * 1111111
IF totMod = 0 THEN
FOR i = 1 TO 15
PRINT dig(i);
NEXT
PRINT , q
END IF
ELSE
psn = psn + 1: placeVal = placeVal / 10
build
psn = psn - 1: placeVal = placeVal * 10
END IF
tot = tot - d * placeVal
NEXT
END SUB

finds

2  3  3  3  3  3  3  2  3  3  3  3  3  3  2             210000012

being the digits of the answer and the quotient upon dividing by 1111111.

 Posted by Charlie on 2010-01-07 15:57:38

 Search: Search body:
Forums (0)