There are three 6 digit numbers with the following properties applicable to each:
1. All digits are unique.
2. The first three digits
ABC form a triangular number as do the latter three,
DEF; both are multiples of 3.
3. The
digital root/sum of the first triangular number is greater than that of the second.
4. Three consecutive digits form the difference of the triangular numbers, either being ascending or descending.
Identify the three 6 digit numbers.
There are 17 triangular numbers that are divisible by 3 and each consisting of 3 different digits:
105 6
120 3
153 9
210 3
231 6
276 6
351 9
378 9
435 3
465 6
528 6
561 3
630 9
741 3
780 6
861 6
903 3
shown here with the digital root of each.
Combining those as specified does produce three 6-digit numbers:
153276 9 6 123
465120 6 3 345
780435 6 3 345
where here the 6-digit number is shown with the digital roots of its two components and the difference between the two 3-digit triangular numbers.
DEFDBL A-Z
DIM tri(100), digRt(100)
triN = 1: addN = 1
DO
addN = addN + 1
triN = triN + addN
IF triN > 100 AND triN < 1000 THEN
tst$ = LTRIM$(STR$(triN))
good = 1
FOR i = 1 TO 2
IF INSTR(i + 1, tst$, MID$(tst$, i, 1)) > 0 THEN good = 0: EXIT FOR
NEXT
IF triN MOD 3 <> 0 THEN good = 0
IF good THEN
triCt = triCt + 1: tri(triCt) = triN
DO
sum = 0
FOR i = 1 TO LEN(tst$)
sum = sum + VAL(MID$(tst$, i, 1))
NEXT
tst$ = LTRIM$(STR$(sum))
LOOP UNTIL LEN(tst$) = 1
digRt(triCt) = VAL(tst$)
PRINT tri(triCt), digRt(triCt)
END IF
END IF
LOOP UNTIL triN > 999
PRINT triCt
FOR i = 1 TO triCt
FOR j = 1 TO triCt
IF i <> j THEN
IF digRt(i) > digRt(j) THEN
whole$ = LTRIM$(STR$(tri(i))) + LTRIM$(STR$(tri(j)))
good = 1
FOR ix = 1 TO 5
IF INSTR(ix + 1, whole$, MID$(whole$, ix, 1)) > 0 THEN good = 0: EXIT FOR
NEXT
IF good THEN
diff$ = LTRIM$(STR$(ABS(tri(i) - tri(j))))
dig1 = VAL(MID$(diff$, 1, 1))
dig2 = VAL(MID$(diff$, 2, 1))
dig3 = VAL(MID$(diff$, 3, 1))
IF dig2 - dig1 = dig3 - dig2 AND ABS(dig2 - dig1) = 1 THEN
PRINT whole$, digRt(i); digRt(j), diff$
END IF
END IF
END IF
END IF
NEXT
NEXT
Edited on August 17, 2008, 7:00 pm
|
Posted by Charlie
on 2008-08-17 18:58:46 |