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

Home > Numbers
Minimum Integer from Last 2 Digits Puzzle (Posted on 2023-01-20) Difficulty: 3 of 5
Determine the minimum value of a positive integer n such that when 3n is represented in base 143, the last two digits (reading left to right) is 01 (in this order).
Provide the required smallest value of n in base 10.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution by Two Methods | Comment 1 of 2
First method:  using mod 20449
For the last 2 digits to be 01, 3^n must be 1 mod 143^2 or 1 mod 20449
for n in range(1,200):
    if (3**n) % 20449 == 1:
        goodN = n
        largeN = 3**n
        print('n =',goodN, '\n', '3^n in base 10:',largeN, '\n')
This outputs
n = 195
3^n in base 10:  
1093061682616768598101980749118434678309602685816438255039403134728775682721408160470718926107

Second method.
Program (this one is recursive) to convert from decimal to arbitrary large integer base.
Instead of letters A=10, B=11, etc, just use the text version of an integer plus a space so the multi-digit "digits" can be distinguished.
For example, using this notation decimal 21 in base 11, instead of looking like 1A would look like 1 10.
def dec2bigbase(i,base):
    """ INPUT integer in base 10, return string
    of Base base equivalent. """
    convertString = [str(i)+' ' for i in range(base)]
    if i < base:
        return convertString[i]
    else:
        return dec2bigbase(i//base,base) + convertString[i%base]

for n in range(1,200):
    bigNumber = dec2bigbase(3**n,143)
    if bigNumber[-5:] == ' 0 1 ':
        print('method 2',n)
OUTPUT:   method 2 195

fyi
dec2bigbase(3^195,143) produces:
 2 40 141 29 79 52 61 74 79 122 117 123 66 25 41 52 128 114 75 11 142 18 135 75 35 31 79 89 25 73 123 36 96 4 71 10 124 75 9 30 118 113 0 1

The last 5 digits of this string are "space,0,space,1,space"

Edited on January 20, 2023, 9:00 am
  Posted by Larry on 2023-01-20 08:56:26

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (5)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
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