Determine the minimum possible multiple of the base ten number 2011 that begins with a nonzero digit and contains all the digits from 0 to 9 at least once. What is the next smallest number with this property?
DEFDBL A-Z
CLS
OPEN "momentml.txt" FOR OUTPUT AS #2
strt = -INT(-1000000000# / 2011)
fin = INT(9999999999# / 2011)
FOR j = strt TO fin
n = j * 2011
ns$ = LTRIM$(STR$(n))
good = 1
FOR i = 1 TO 9
IF INSTR(MID$(ns$, i + 1), MID$(ns$, i, 1)) THEN good = 0: EXIT FOR
NEXT
IF good THEN PRINT j, n: PRINT #2, j, n: ct = ct + 1
NEXT
PRINT ct
Finds there are 1610 pandigital multiples of 2011, starting with
510678 1026973458
514989 1035642879
515439 1036547829
516978 1039642758
518796 1043298756
520623 1046972853
520785 1047298635
521397 1048529367
525726 1057234986
526968 1059732648
529218 1064257398
531225 1068293475
533349 1072564839
533862 1073596482
534042 1073958462
538686 1083297546
538884 1083695724
539163 1084256793
540225 1086392475
...
and ending with
...
4848984 9751306824
4849533 9752410863
4850388 9754130268
4851468 9756302148
4852512 9758401632
4856193 9765804123
4856211 9765840321
4863960 9781423560
4865373 9784265103
4874796 9803214756
4876785 9807214635
4878342 9810345762
4878387 9810436257
4886676 9827105436
4886874 9827503614
4888377 9830526147
4890951 9835702461
4893597 9841023567
4893885 9841602735
4893912 9841657032
4895883 9845620713
4898124 9850127364
4898421 9850724631
4899240 9852371640
4899861 9853620471
4900383 9854670213
4901130 9856172430
4901742 9857403162
4908312 9870615432
4909230 9872461530
4911012 9876045132
listed only for 10-digit numbers, as a higher number of digits means larger numbers, only to repeat unnecessarily some of the digits.
|
Posted by Charlie
on 2011-11-10 15:37:29 |