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

 Seven come eleven (Posted on 2010-12-11)
A positive integer N fulfills the following demands:.
N is a 7 digit number.
N's digits can be arranged as seven distinct members of an arithmetic progression(either ascending or descending) .

N is a multiple of 11.

How many positive integers like N exist?
Evaluate the lowest and the highest N.
BONUS : How about 8 digits? Nine? All ten?
Rem: It is D4 for fully explained and errorless P&P result,might be significantly lower for software solution.

Comments: ( Back to comment list | You must be logged in to post comments.)
 7 thru 9 again | Comment 9 of 12 |

1042536
7             1728
9857463

10234576
8             13248
98764523

102347586
9             61632
987652413

DEFDBL A-Z
PRINT : PRINT
FOR sz = 7 TO 9
ct = 0
n = INT(10 ^ (sz - 1))
n = n + 11 - (n MOD 11)
DO
ns\$ = LTRIM\$(STR\$(n))
c\$ = ns\$
REDIM used(9)
low = 99: high = -1
good = 1
FOR i = 1 TO LEN(c\$)
d = VAL(MID\$(c\$, i, 1))
IF used(d) THEN good = 0: EXIT FOR
used(d) = 1
IF d < low THEN low = d
IF d > high THEN high = d
NEXT
IF good THEN
IF high - low = sz - 1 THEN
ct = ct + 1
IF did(sz) = 0 THEN PRINT prev\$: PRINT ns\$: did(sz) = 1
prev\$ = ns\$
END IF
END IF
n = n + 11
LOOP UNTIL n > 10 ^ sz
PRINT sz, ct
NEXT sz
PRINT prev\$

 Posted by Charlie on 2010-12-11 17:06:09

 Search: Search body:
Forums (0)