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

Home > Numbers
Product Crossed Pointed Ratio Puzzle (Posted on 2022-07-27) Difficulty: 3 of 5
n is a positive integer base from 2 to 36 inclusively.
Each of α and β is a nonzero digit of base n from 1 to n-1 inclusively.

Determine all possible triplets (α, β, n) such that:
(α*β)base n
-----------  is a positive integer.
(α.β)base n 
### For example, in base ten corresponding to (α, β) = (4, 5), we observe that:
(4*5)/(4.5) = 40/9, which is NOT a positive integer.

No Solution Yet Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): computer solution - 3 other solutions | Comment 6 of 7 |
(In reply to re: computer solution - 3 other solutions by Larry)

I hadn't realized that declaring a, b, f, numerator, and denominator as syms was not sufficient. I had to make sure syms were placed in them; there's no conversion taking place. Only when operations are performed with ordinary numbers does conversion to sym take place for the result.  Some numbers were small fractions off.


Python, which you use, uses indefinitely long integers by default.

Total of 77 appears at the bottom.

New version:

clearvars,clc
ct=0;
syms n a b numerator denominator f
for n=2:36
  for a=1:n-1
    for b=1:n-1
      numerator=sym(a)*b;
      denominator=sym(a)+sym(b)/n;
      f=numerator/denominator;
      if round(f)==f
  %      disp([a b n numerator denominator f])
        sout=sprintf('%2d %2d %2d %13.9f %13.9f %13.9f \n',a, b, n, numerator, denominator, f);
        trans=false; ppos=0;
        for i=1:length(sout)
          switch sout(i)
            case '.'
              trans=true; ppos=i;
            case {' ' '\n'  }
             if trans==true
              trans=false; 
              for j=i-1:-1:ppos 
                if sout(j)>'0' && sout(j) <='9'
                  break
                end
                if sout(j)=='0'
                  sout(j)=' ';
                else
                  if sout(j)=='.'
                    sout(j)=' ';
                    break
                  end
                end
              end
              ppos=0; 
             end 
          end
        end
        fprintf('%s',sout);
        ct=ct+1;
      end
    end
  end
end
disp(ct)

for n=2:36
  for a=1:n-1
    for b=1:n-1
      if n==15 && a==1 && b==10
        n=n;
      end
      numerator=sym(a)*b;
      denominator=a+sym(b)/n;
      f=numerator/denominator;
      if round(f)==f
        ab=dec2base(a,n);
        bb=dec2base(b,n);
        nc=char(string(n));
        disp([ab ' ' bb ' ' nc])
        ct=ct+1;
      end
    end
  end
end
disp(ct)

         decimal   representation                   base-n rep.
--------------------------------------------------  ---------
alpha  n    numerator    denominator    result      alpha
   beta                                                  beta
 1  3  6         3       1.5               2           1 3 
 2  4  6         8       2.666666667       3           2 4 
 2  5 10        10       2.5               4           2 5 
 3  6 10        18       3.6               5           3 6 
 1  4 12         4       1.333333333       3           1 4 
 1  6 12         6       1.5               4           1 6 
 2  8 12        16       2.666666667       6           2 8 
 6  9 12        54       6.75              8           6 9 
 3  7 14        21       3.5               6           3 7 
 4  8 14        32       4.571428571       7           4 8 
 1 10 15        10       1.666666667       6           1 A 
 2  6 15        12       2.4               5           2 6 
 4 12 15        48       4.8              10           4 C 
 6 10 15        60       6.666666667       9           6 A 
 1  9 18         9       1.5               6           1 9 
 2 12 18        24       2.666666667       9           2 C 
 4  9 18        36       4.5               8           4 9 
 5 10 18        50       5.555555556       9           5 A 
 1  5 20         5       1.25              4           1 5 
 2 10 20        20       2.5               8           2 A 
 3 12 20        36       3.6              10           3 C 
 3 15 20        45       3.75             12           3 F 
12 16 20       192      12.8              15           C G 
 2  7 21        14       2.333333333       6           2 7 
 3 18 21        54       3.857142857      14           3 I 
 4 14 21        56       4.666666667      12           4 E 
10 15 21       150      10.714285714      14           A F 
 5 11 22        55       5.5              10           5 B 
 6 12 22        72       6.545454545      11           6 C 
 1  8 24         8       1.333333333       6           1 8 
 1 12 24        12       1.5               8           1 C 
 2 16 24        32       2.666666667      12           2 G 
 3  9 24        27       3.375             8           3 9 
 6 18 24       108       6.75             16           6 I 
10 16 24       160      10.666666667      15           A G 
 6 13 26        78       6.5              12           6 D 
 7 14 26        98       7.538461538      13           7 E 
 1 21 28        21       1.75             12           1 L 
 2  8 28        16       2.285714286       7           2 8 
 3 14 28        42       3.5              12           3 E 
 4 16 28        64       4.571428571      14           4 G 
 6 24 28       144       6.857142857      21           6 O 
15 21 28       315      15.75             20           F L 
 1  6 30         6       1.2               5           1 6 
 1 15 30        15       1.5              10           1 F 
 1 20 30        20       1.666666667      12           1 K 
 2 12 30        24       2.4              10           2 C 
 2 15 30        30       2.5              12           2 F 
 2 20 30        40       2.666666667      15           2 K 
 3 10 30        30       3.333333333       9           3 A 
 3 18 30        54       3.6              15           3 I 
 4 24 30        96       4.8              20           4 O 
 6 20 30       120       6.666666667      18           6 K 
 7 15 30       105       7.5              14           7 F 
 8 16 30       128       8.533333333      15           8 G 
14 21 30       294      14.7              20           E L 
20 25 30       500      20.833333333      24           K P 
 3 22 33        66       3.666666667      18           3 M 
 4 12 33        48       4.363636364      11           4 C 
 8 24 33       192       8.727272727      22           8 O 
14 22 33       308      14.666666667      21           E M 
 8 17 34       136       8.5              16           8 H 
 9 18 34       162       9.529411765      17           9 I 
 1 14 35        14       1.4              10           1 E 
 2 28 35        56       2.8              20           2 S 
 2 30 35        60       2.857142857      21           2 U 
 6 15 35        90       6.428571429      14           6 F 
12 21 35       252      12.6              20           C L 
12 30 35       360      12.857142857      28           C U 
 1 12 36        12       1.333333333       9           1 C 
 1 18 36        18       1.5              12           1 I 
 2  9 36        18       2.25              8           2 9 
 2 24 36        48       2.666666667      18           2 O 
 4 18 36        72       4.5              16           4 I 
 5 20 36       100       5.555555556      18           5 K 
 6 27 36       162       6.75             24           6 R 
21 28 36       588      21.777777778      27           L S 
    77


  Posted by Charlie on 2022-07-28 16:34:23
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 (22)
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