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

Home > Just Math
Doubles on reverse (Posted on 2008-09-02) Difficulty: 2 of 5
In the problem "Mirror, mirror on the wall" it was proved that no number in the decimal system doubles on reversing its digits, and answered for bases 3, 5 and 8 (base 2 has leading zero, so itīs not valid).

Generalise the answer for positive integer bases.

See The Solution Submitted by pcbouhid    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts computer exploration -- some answers given | Comment 1 of 3

The following is not a general solution, but covers bases up to 124 for numbers 1 to 3600.

The program below tests numbers that in decimal are 1 to 3600, in bases up to 124, but stops if the point is reached where the number is represented by a single digit.

CLS
DEFDBL A-Z
digits$ = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ---------------------------------------------------------------"
bMax = LEN(digits$) - 1: PRINT bMax
FOR n = 1 TO 3600
  b = 2
  DO
    n$ = "": n2$ = "": n2 = 0
    t = n
    DO
      d = t MOD b
      t = t \ b
      dig$ = MID$(digits$, d + 1, 1)
      n$ = dig$ + n$
      n2$ = n2$ + dig$
      n2 = n2 * b + d
    LOOP UNTIL t = 0
    IF n2 = 2 * n THEN
      PRINT "base";
      PRINT USING "###"; b;
      PRINT "; decimal ";
      PRINT USING "######"; n2; n;
      PRINT "; "; n2$; " "; n$
    END IF
    b = b + 1
  LOOP UNTIL LEN(n$) = 1 OR b > bMax
NEXT

The results are sorted below on base and the number. The decimal representations of the number and reverse are shown as well as the representations in the given base. For bases higher than ten, lower-case letters a through z represent 10 through 35, and capital A through Z represent 36 through 61. When a digit higher than 61 is needed, its place is taken by a hyphen. The program kept track of the actual value of that hyphen, so that spurious matches are not shown just because a hyphen was used for different digits.

base  3; decimal     64    32; 2101 1012
base  3; decimal    208   104; 21201 10212
base  3; decimal    640   320; 212201 102212
base  3; decimal   1936   968; 2122201 1022212
base  3; decimal   5248  2624; 21012101 10121012
base  3; decimal   5824  2912; 21222201 10222212
base  5; decimal     16     8; 31 13
base  5; decimal     96    48; 341 143
base  5; decimal    416   208; 3131 1313
base  5; decimal    496   248; 3441 1443
base  5; decimal   2016  1008; 31031 13013
base  5; decimal   2496  1248; 34441 14443
base  6; decimal    980   490; 4312 2134
base  6; decimal   6020  3010; 43512 21534
base  8; decimal     42    21; 52 25
base  8; decimal    378   189; 572 275
base  8; decimal   2730  1365; 5252 2525
base  8; decimal   3066  1533; 5772 2775
base  9; decimal   4800  2400; 6523 3256
base 11; decimal     80    40; 73 37
base 11; decimal    960   480; 7a3 3a7
base 14; decimal    130    65; 94 49
base 14; decimal   1950   975; 9d4 4d9
base 17; decimal    192    96; b5 5b
base 17; decimal   3456  1728; bg5 5gb
base 20; decimal    266   133; d6 6d
base 20; decimal   5586  2793; dj6 6jd
base 23; decimal    352   176; f7 7f
base 26; decimal    450   225; h8 8h
base 29; decimal    560   280; j9 9j
base 32; decimal    682   341; la al
base 35; decimal    816   408; nb bn
base 38; decimal    962   481; pc cp
base 41; decimal   1120   560; rd dr
base 44; decimal   1290   645; te et
base 47; decimal   1472   736; vf fv
base 50; decimal   1666   833; xg gx
base 53; decimal   1872   936; zh hz
base 56; decimal   2090  1045; Bi iB
base 59; decimal   2320  1160; Dj jD
base 62; decimal   2562  1281; Fk kF
base 65; decimal   2816  1408; Hl lH
base 68; decimal   3082  1541; Jm mJ
base 71; decimal   3360  1680; Ln nL
base 74; decimal   3650  1825; No oN
base 77; decimal   3952  1976; Pp pP
base 80; decimal   4266  2133; Rq qR
base 83; decimal   4592  2296; Tr rT
base 86; decimal   4930  2465; Vs sV
base 89; decimal   5280  2640; Xt tX
base 92; decimal   5642  2821; Zu uZ
base 95; decimal   6016  3008; -v v-
base 98; decimal   6402  3201; -w w-
base101; decimal   6800  3400; -x x-

  Posted by Charlie on 2008-09-02 17:43:46
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 (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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