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

Home > Just Math
Productive Numbers (Posted on 2013-05-26) Difficulty: 3 of 5
Find all possible 9-digit numbers using precisely nine distinct digits from 0 to 9 such that each pair of consecutive digits is the product of two single-digit numbers.

For example, 2 and 1 can appear next to each other since 3*7=21. However, 2 and 6 cannot appear next to each other since 26 is the product only of 2 and 13 (and 1 and 26), and each pair of factors contains a number that is not a single-digit number.

*** None of the 9-digit numbers can contain any leading zero.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution: the long list (spoilers) | Comment 5 of 6 |

There's nothing in the puzzle that says the pairs of consecutive digits cannot have a leading zero, so the zero can come anywhere in the 9-digit number except at the beginning.

DECLARE SUB addOn ()
DEFDBL A-Z
CLEAR , , 25000
CLS

DIM SHARED pn, used(9), ct

OPEN "prodnumb.txt" FOR OUTPUT AS #2

FOR strt = 1 TO 9
  pn = strt
  used(strt) = 1
  addOn
  used(strt) = 0
NEXT

CLOSE

PRINT ct

OPEN "prodnumb.txt" FOR INPUT AS #1
OPEN "prodnum2.txt" FOR OUTPUT AS #2
DO
  INPUT #1, n$
  PRINT #2, n$
  FOR i = 1 TO LEN(n$) - 1
    v = VAL(MID$(n$, i, 2))
    FOR dv = 1 TO 9
      q = v / dv
      IF q = INT(q) THEN
        IF q < 10 THEN
          PRINT #2, LTRIM$(STR$(dv)); "*"; LTRIM$(STR$(q)); " ";
          EXIT FOR
        END IF
      END IF
    NEXT
  NEXT
  PRINT #2, : PRINT #2,
LOOP UNTIL EOF(1)
CLOSE

SUB addOn
  FOR d = 0 TO 9
    IF used(d) = 0 THEN
      tst = 10 * (pn MOD 10) + d
      good = 0
      FOR dv = 1 TO 9
        q = tst / dv
        IF q = INT(q) THEN
          IF q < 10 THEN good = 1: EXIT FOR
        END IF
      NEXT dv
      IF good THEN
        pn = pn * 10 + d
        used(d) = 1
        IF pn > 99999999 THEN
          PRINT pn
          PRINT #2, pn
          ct = ct + 1
        ELSE
          addOn
        END IF
        pn = pn \ 10
        used(d) = 0
      END IF
    END IF
  NEXT d
END SUB

produces an extensive list of 229 such 9-digit numbers, and then expands each with the single-digit factors of the pairs of digits:

145630728
2*7 5*9 7*8 7*9 5*6 1*7 8*9 4*7

156307248
3*5 7*8 7*9 5*6 1*7 8*9 3*8 6*8

156307249
3*5 7*8 7*9 5*6 1*7 8*9 3*8 7*7

163072548
2*8 7*9 5*6 1*7 8*9 5*5 6*9 6*8

163072549
2*8 7*9 5*6 1*7 8*9 5*5 6*9 7*7

163540728
2*8 7*9 5*7 6*9 5*8 1*7 8*9 4*7

208163549
4*5 1*8 9*9 2*8 7*9 5*7 6*9 7*7

248156307
3*8 6*8 9*9 3*5 7*8 7*9 5*6 1*7

248156309
3*8 6*8 9*9 3*5 7*8 7*9 5*6 1*9

254816307
5*5 6*9 6*8 9*9 2*8 7*9 5*6 1*7

254816309
5*5 6*9 6*8 9*9 2*8 7*9 5*6 1*9

256308149
5*5 7*8 7*9 5*6 1*8 9*9 2*7 7*7

281035649
4*7 9*9 2*5 1*3 5*7 7*8 8*8 7*7

281063549
4*7 9*9 2*5 1*6 7*9 5*7 6*9 7*7

281456307
4*7 9*9 2*7 5*9 7*8 7*9 5*6 1*7

281456309
4*7 9*9 2*7 5*9 7*8 7*9 5*6 1*9

281563049
4*7 9*9 3*5 7*8 7*9 5*6 1*4 7*7

281630549
4*7 9*9 2*8 7*9 5*6 1*5 6*9 7*7

281635407
4*7 9*9 2*8 7*9 5*7 6*9 5*8 1*7

281635409
4*7 9*9 2*8 7*9 5*7 6*9 5*8 1*9

302815649
5*6 1*2 4*7 9*9 3*5 7*8 8*8 7*7

305648127
5*6 1*5 7*8 8*8 6*8 9*9 2*6 3*9

307215648
5*6 1*7 8*9 3*7 3*5 7*8 8*8 6*8

307215649
5*6 1*7 8*9 3*7 3*5 7*8 8*8 7*7

307248156
5*6 1*7 8*9 3*8 6*8 9*9 3*5 7*8

307254816
5*6 1*7 8*9 5*5 6*9 6*8 9*9 2*8

307256481
5*6 1*7 8*9 5*5 7*8 8*8 6*8 9*9

307281456
5*6 1*7 8*9 4*7 9*9 2*7 5*9 7*8

307281549
5*6 1*7 8*9 4*7 9*9 3*5 6*9 7*7

307281564
5*6 1*7 8*9 4*7 9*9 3*5 7*8 8*8

307281645
5*6 1*7 8*9 4*7 9*9 2*8 8*8 5*9

307281649
5*6 1*7 8*9 4*7 9*9 2*8 8*8 7*7

308125649
5*6 1*8 9*9 2*6 5*5 7*8 8*8 7*7

308156427
5*6 1*8 9*9 3*5 7*8 8*8 6*7 3*9

320815649
4*8 4*5 1*8 9*9 3*5 7*8 8*8 7*7

325648107
4*8 5*5 7*8 8*8 6*8 9*9 2*5 1*7

325648109
4*8 5*5 7*8 8*8 6*8 9*9 2*5 1*9

328105649
4*8 4*7 9*9 2*5 1*5 7*8 8*8 7*7

328156407
4*8 4*7 9*9 3*5 7*8 8*8 5*8 1*7

328156409
4*8 4*7 9*9 3*5 7*8 8*8 5*8 1*9

354072816
5*7 6*9 5*8 1*7 8*9 4*7 9*9 2*8

356407218
5*7 7*8 8*8 5*8 1*7 8*9 3*7 2*9

356407281
5*7 7*8 8*8 5*8 1*7 8*9 4*7 9*9

356408127
5*7 7*8 8*8 5*8 1*8 9*9 2*6 3*9

356428107
5*7 7*8 8*8 6*7 4*7 9*9 2*5 1*7

356428109
5*7 7*8 8*8 6*7 4*7 9*9 2*5 1*9

356481027
5*7 7*8 8*8 6*8 9*9 2*5 1*2 3*9

356481072
5*7 7*8 8*8 6*8 9*9 2*5 1*7 8*9

356481207
5*7 7*8 8*8 6*8 9*9 2*6 4*5 1*7

356481209
5*7 7*8 8*8 6*8 9*9 2*6 4*5 1*9

364072815
4*9 8*8 5*8 1*7 8*9 4*7 9*9 3*5

364810725
4*9 8*8 6*8 9*9 2*5 1*7 8*9 5*5

407281563
5*8 1*7 8*9 4*7 9*9 3*5 7*8 7*9

407281635
5*8 1*7 8*9 4*7 9*9 2*8 7*9 5*7

408156327
5*8 1*8 9*9 3*5 7*8 7*9 4*8 3*9

428156307
6*7 4*7 9*9 3*5 7*8 7*9 5*6 1*7

428156309
6*7 4*7 9*9 3*5 7*8 7*9 5*6 1*9

456307218
5*9 7*8 7*9 5*6 1*7 8*9 3*7 2*9

456307281
5*9 7*8 7*9 5*6 1*7 8*9 4*7 9*9

456308127
5*9 7*8 7*9 5*6 1*8 9*9 2*6 3*9

456328107
5*9 7*8 7*9 4*8 4*7 9*9 2*5 1*7

456328109
5*9 7*8 7*9 4*8 4*7 9*9 2*5 1*9

481056327
6*8 9*9 2*5 1*5 7*8 7*9 4*8 3*9

481072563
6*8 9*9 2*5 1*7 8*9 5*5 7*8 7*9

481256307
6*8 9*9 2*6 5*5 7*8 7*9 5*6 1*7

481256309
6*8 9*9 2*6 5*5 7*8 7*9 5*6 1*9

481563027
6*8 9*9 3*5 7*8 7*9 5*6 1*2 3*9

481563072
6*8 9*9 3*5 7*8 7*9 5*6 1*7 8*9

481563207
6*8 9*9 3*5 7*8 7*9 4*8 4*5 1*7

481563209
6*8 9*9 3*5 7*8 7*9 4*8 4*5 1*9

481630725
6*8 9*9 2*8 7*9 5*6 1*7 8*9 5*5

540728163
6*9 5*8 1*7 8*9 4*7 9*9 2*8 7*9

540816327
6*9 5*8 1*8 9*9 2*8 7*9 4*8 3*9

542816307
6*9 6*7 4*7 9*9 2*8 7*9 5*6 1*7

542816309
6*9 6*7 4*7 9*9 2*8 7*9 5*6 1*9

548106327
6*9 6*8 9*9 2*5 1*6 7*9 4*8 3*9

548163027
6*9 6*8 9*9 2*8 7*9 5*6 1*2 3*9

548163072
6*9 6*8 9*9 2*8 7*9 5*6 1*7 8*9

548163207
6*9 6*8 9*9 2*8 7*9 4*8 4*5 1*7

548163209
6*9 6*8 9*9 2*8 7*9 4*8 4*5 1*9

563028149
7*8 7*9 5*6 1*2 4*7 9*9 2*7 7*7

563048127
7*8 7*9 5*6 1*4 6*8 9*9 2*6 3*9

563072148
7*8 7*9 5*6 1*7 8*9 3*7 2*7 6*8

563072149
7*8 7*9 5*6 1*7 8*9 3*7 2*7 7*7

563072481
7*8 7*9 5*6 1*7 8*9 3*8 6*8 9*9

563072814
7*8 7*9 5*6 1*7 8*9 4*7 9*9 2*7

563081249
7*8 7*9 5*6 1*8 9*9 2*6 3*8 7*7

563081427
7*8 7*9 5*6 1*8 9*9 2*7 6*7 3*9

563208149
7*8 7*9 4*8 4*5 1*8 9*9 2*7 7*7

563248107
7*8 7*9 4*8 3*8 6*8 9*9 2*5 1*7

563248109
7*8 7*9 4*8 3*8 6*8 9*9 2*5 1*9

563281049
7*8 7*9 4*8 4*7 9*9 2*5 1*4 7*7

563281407
7*8 7*9 4*8 4*7 9*9 2*7 5*8 1*7

563281409
7*8 7*9 4*8 4*7 9*9 2*7 5*8 1*9

564810327
7*8 8*8 6*8 9*9 2*5 1*3 4*8 3*9

630281549
7*9 5*6 1*2 4*7 9*9 3*5 6*9 7*7

630548127
7*9 5*6 1*5 6*9 6*8 9*9 2*6 3*9

630721548
7*9 5*6 1*7 8*9 3*7 3*5 6*9 6*8

630721549
7*9 5*6 1*7 8*9 3*7 3*5 6*9 7*7

630724815
7*9 5*6 1*7 8*9 3*8 6*8 9*9 3*5

630725481
7*9 5*6 1*7 8*9 5*5 6*9 6*8 9*9

630728145
7*9 5*6 1*7 8*9 4*7 9*9 2*7 5*9

630728149
7*9 5*6 1*7 8*9 4*7 9*9 2*7 7*7

630728154
7*9 5*6 1*7 8*9 4*7 9*9 3*5 6*9

630812549
7*9 5*6 1*8 9*9 2*6 5*5 6*9 7*7

630815427
7*9 5*6 1*8 9*9 3*5 6*9 6*7 3*9

632081549
7*9 4*8 4*5 1*8 9*9 3*5 6*9 7*7

632548107
7*9 4*8 5*5 6*9 6*8 9*9 2*5 1*7

632548109
7*9 4*8 5*5 6*9 6*8 9*9 2*5 1*9

632810549
7*9 4*8 4*7 9*9 2*5 1*5 6*9 7*7

632815407
7*9 4*8 4*7 9*9 3*5 6*9 5*8 1*7

632815409
7*9 4*8 4*7 9*9 3*5 6*9 5*8 1*9

635407218
7*9 5*7 6*9 5*8 1*7 8*9 3*7 2*9

635407281
7*9 5*7 6*9 5*8 1*7 8*9 4*7 9*9

635408127
7*9 5*7 6*9 5*8 1*8 9*9 2*6 3*9

635428107
7*9 5*7 6*9 6*7 4*7 9*9 2*5 1*7

635428109
7*9 5*7 6*9 6*7 4*7 9*9 2*5 1*9

635481027
7*9 5*7 6*9 6*8 9*9 2*5 1*2 3*9

635481072
7*9 5*7 6*9 6*8 9*9 2*5 1*7 8*9

635481207
7*9 5*7 6*9 6*8 9*9 2*6 4*5 1*7

635481209
7*9 5*7 6*9 6*8 9*9 2*6 4*5 1*9

720163548
8*9 4*5 1*1 2*8 7*9 5*7 6*9 6*8

720163549
8*9 4*5 1*1 2*8 7*9 5*7 6*9 7*7

720354816
8*9 4*5 1*3 5*7 6*9 6*8 9*9 2*8

720356481
8*9 4*5 1*3 5*7 7*8 8*8 6*8 9*9

720364815
8*9 4*5 1*3 4*9 8*8 6*8 9*9 3*5

720481563
8*9 4*5 1*4 6*8 9*9 3*5 7*8 7*9

720481635
8*9 4*5 1*4 6*8 9*9 2*8 7*9 5*7

720548163
8*9 4*5 1*5 6*9 6*8 9*9 2*8 7*9

720635481
8*9 4*5 1*6 7*9 5*7 6*9 6*8 9*9

720814563
8*9 4*5 1*8 9*9 2*7 5*9 7*8 7*9

720815649
8*9 4*5 1*8 9*9 3*5 7*8 8*8 7*7

720816354
8*9 4*5 1*8 9*9 2*8 7*9 5*7 6*9

721035648
8*9 3*7 2*5 1*3 5*7 7*8 8*8 6*8

721035649
8*9 3*7 2*5 1*3 5*7 7*8 8*8 7*7

721063548
8*9 3*7 2*5 1*6 7*9 5*7 6*9 6*8

721063549
8*9 3*7 2*5 1*6 7*9 5*7 6*9 7*7

721456308
8*9 3*7 2*7 5*9 7*8 7*9 5*6 1*8

721456309
8*9 3*7 2*7 5*9 7*8 7*9 5*6 1*9

721563048
8*9 3*7 3*5 7*8 7*9 5*6 1*4 6*8

721563049
8*9 3*7 3*5 7*8 7*9 5*6 1*4 7*7

721630548
8*9 3*7 2*8 7*9 5*6 1*5 6*9 6*8

721630549
8*9 3*7 2*8 7*9 5*6 1*5 6*9 7*7

721635408
8*9 3*7 2*8 7*9 5*7 6*9 5*8 1*8

721635409
8*9 3*7 2*8 7*9 5*7 6*9 5*8 1*9

724081563
8*9 3*8 5*8 1*8 9*9 3*5 7*8 7*9

724081635
8*9 3*8 5*8 1*8 9*9 2*8 7*9 5*7

724563018
8*9 3*8 5*9 7*8 7*9 5*6 1*1 2*9

724563081
8*9 3*8 5*9 7*8 7*9 5*6 1*8 9*9

724810356
8*9 3*8 6*8 9*9 2*5 1*3 5*7 7*8

724810563
8*9 3*8 6*8 9*9 2*5 1*5 7*8 7*9

724810635
8*9 3*8 6*8 9*9 2*5 1*6 7*9 5*7

724815630
8*9 3*8 6*8 9*9 3*5 7*8 7*9 5*6

724816305
8*9 3*8 6*8 9*9 2*8 7*9 5*6 1*5

724816309
8*9 3*8 6*8 9*9 2*8 7*9 5*6 1*9

725408163
8*9 5*5 6*9 5*8 1*8 9*9 2*8 7*9

725481036
8*9 5*5 6*9 6*8 9*9 2*5 1*3 4*9

725481063
8*9 5*5 6*9 6*8 9*9 2*5 1*6 7*9

725481630
8*9 5*5 6*9 6*8 9*9 2*8 7*9 5*6

725630148
8*9 5*5 7*8 7*9 5*6 1*1 2*7 6*8

725630149
8*9 5*5 7*8 7*9 5*6 1*1 2*7 7*7

725630481
8*9 5*5 7*8 7*9 5*6 1*4 6*8 9*9

725630814
8*9 5*5 7*8 7*9 5*6 1*8 9*9 2*7

725648103
8*9 5*5 7*8 8*8 6*8 9*9 2*5 1*3

725648109
8*9 5*5 7*8 8*8 6*8 9*9 2*5 1*9

728103549
8*9 4*7 9*9 2*5 1*3 5*7 6*9 7*7

728103564
8*9 4*7 9*9 2*5 1*3 5*7 7*8 8*8

728103645
8*9 4*7 9*9 2*5 1*3 4*9 8*8 5*9

728103649
8*9 4*7 9*9 2*5 1*3 4*9 8*8 7*7

728104563
8*9 4*7 9*9 2*5 1*4 5*9 7*8 7*9

728105649
8*9 4*7 9*9 2*5 1*5 7*8 8*8 7*7

728106354
8*9 4*7 9*9 2*5 1*6 7*9 5*7 6*9

728140356
8*9 4*7 9*9 2*7 5*8 1*3 5*7 7*8

728140563
8*9 4*7 9*9 2*7 5*8 1*5 7*8 7*9

728140635
8*9 4*7 9*9 2*7 5*8 1*6 7*9 5*7

728145630
8*9 4*7 9*9 2*7 5*9 7*8 7*9 5*6

728154036
8*9 4*7 9*9 3*5 6*9 5*8 1*3 4*9

728154063
8*9 4*7 9*9 3*5 6*9 5*8 1*6 7*9

728156304
8*9 4*7 9*9 3*5 7*8 7*9 5*6 1*4

728156309
8*9 4*7 9*9 3*5 7*8 7*9 5*6 1*9

728156403
8*9 4*7 9*9 3*5 7*8 8*8 5*8 1*3

728156409
8*9 4*7 9*9 3*5 7*8 8*8 5*8 1*9

728163045
8*9 4*7 9*9 2*8 7*9 5*6 1*4 5*9

728163049
8*9 4*7 9*9 2*8 7*9 5*6 1*4 7*7

728163054
8*9 4*7 9*9 2*8 7*9 5*6 1*5 6*9

728163540
8*9 4*7 9*9 2*8 7*9 5*7 6*9 5*8

728163549
8*9 4*7 9*9 2*8 7*9 5*7 6*9 7*7

728164035
8*9 4*7 9*9 2*8 8*8 5*8 1*3 5*7

810325649
9*9 2*5 1*3 4*8 5*5 7*8 8*8 7*7

810356427
9*9 2*5 1*3 5*7 7*8 8*8 6*7 3*9

810456327
9*9 2*5 1*4 5*9 7*8 7*9 4*8 3*9

810563249
9*9 2*5 1*5 7*8 7*9 4*8 3*8 7*7

810632549
9*9 2*5 1*6 7*9 4*8 5*5 6*9 7*7

810635427
9*9 2*5 1*6 7*9 5*7 6*9 6*7 3*9

810724563
9*9 2*5 1*7 8*9 3*8 5*9 7*8 7*9

810725649
9*9 2*5 1*7 8*9 5*5 7*8 8*8 7*7

812035649
9*9 2*6 4*5 1*3 5*7 7*8 8*8 7*7

812063549
9*9 2*6 4*5 1*6 7*9 5*7 6*9 7*7

812456307
9*9 2*6 3*8 5*9 7*8 7*9 5*6 1*7

812456309
9*9 2*6 3*8 5*9 7*8 7*9 5*6 1*9

812563049
9*9 2*6 5*5 7*8 7*9 5*6 1*4 7*7

814056327
9*9 2*7 5*8 1*5 7*8 7*9 4*8 3*9

814072563
9*9 2*7 5*8 1*7 8*9 5*5 7*8 7*9

814256307
9*9 2*7 6*7 5*5 7*8 7*9 5*6 1*7

814256309
9*9 2*7 6*7 5*5 7*8 7*9 5*6 1*9

814563027
9*9 2*7 5*9 7*8 7*9 5*6 1*2 3*9

814563072
9*9 2*7 5*9 7*8 7*9 5*6 1*7 8*9

814563207
9*9 2*7 5*9 7*8 7*9 4*8 4*5 1*7

814563209
9*9 2*7 5*9 7*8 7*9 4*8 4*5 1*9

815406327
9*9 3*5 6*9 5*8 1*6 7*9 4*8 3*9

815630249
9*9 3*5 7*8 7*9 5*6 1*2 3*8 7*7

815630427
9*9 3*5 7*8 7*9 5*6 1*4 6*7 3*9

815630724
9*9 3*5 7*8 7*9 5*6 1*7 8*9 3*8

815632049
9*9 3*5 7*8 7*9 4*8 4*5 1*4 7*7

815632407
9*9 3*5 7*8 7*9 4*8 3*8 5*8 1*7

815632409
9*9 3*5 7*8 7*9 4*8 3*8 5*8 1*9

815640327
9*9 3*5 7*8 8*8 5*8 1*3 4*8 3*9

816302549
9*9 2*8 7*9 5*6 1*2 5*5 6*9 7*7

816305427
9*9 2*8 7*9 5*6 1*5 6*9 6*7 3*9

816307245
9*9 2*8 7*9 5*6 1*7 8*9 3*8 5*9

816307249
9*9 2*8 7*9 5*6 1*7 8*9 3*8 7*7

816307254
9*9 2*8 7*9 5*6 1*7 8*9 5*5 6*9

816320549
9*9 2*8 7*9 4*8 4*5 1*5 6*9 7*7

816325407
9*9 2*8 7*9 4*8 5*5 6*9 5*8 1*7

816325409
9*9 2*8 7*9 4*8 5*5 6*9 5*8 1*9

816354027
9*9 2*8 7*9 5*7 6*9 5*8 1*2 3*9

816354072
9*9 2*8 7*9 5*7 6*9 5*8 1*7 8*9

816354207
9*9 2*8 7*9 5*7 6*9 6*7 4*5 1*7

816354209
9*9 2*8 7*9 5*7 6*9 6*7 4*5 1*9


  Posted by Charlie on 2013-05-26 14:58:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information