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.
DECLARE SUB permute (a$)
a$ = "0123456789": h$ = a$
IF LEFT$(a$, 1) > "0" THEN
v = VAL(a$)
vm = v - 11 * INT(v / 11)
IF vm = 0 THEN ct = ct + 1
LOOP UNTIL a$ = h$
Posted by Charlie
on 2010-12-11 15:28:45