Concatenation puzzle: when (A || B) / B is an integer

Concatenation is the joining of two numbers by their numerals. That is, the concatenation of   444   and   777   is   444777.

Concatenation of numbers   A   and   B   is denoted   A || B.

A   and   B   are three-digit integers.   So   A || B   is a 6-digit number.

So, what is the smallest integer of the form   (A || B) / B ?
Note the trivial solution is :
A = 001,   B = 500,   then   A || B = 001500   and   (A || B)/B   =   001500/500   =   3


About benvitalis

math grad - Interest: Number theory
This entry was posted in Number Puzzles and tagged , . Bookmark the permalink.

1 Response to Concatenation puzzle: when (A || B) / B is an integer

  1. David a/k/a @InfinitelyManic says:

    # David a/k/a/ @InfinitelyManic
    # Concatenation puzzle: when (A||B)/B is an integer

    # import Fractions from fractions module
    from fractions import *

    # declare list sol[utions]
    sol = []
    # we are going to put the data in a file
    f = open(‘results.txt’,’w’)
    # create two (2) for loops using range. Range will end at 999, respectively.
    for A in range(100,1000):
    for B in range(100,1000):
    # concat A & B; turn into an int then do the math
    frac = Fraction(int(str(A)+str(B)),int(B))
    # if the denominator is 1 then write “A,B, fraction form, and numerator” to text file
    if frac.denominator == 1:
    sol = [A,B,str(A)+str(B),’/’,B,frac.numerator]

    # close the file

    # #########Linux Bash ##############
    $ sort -n -k6 -t, results.txt | less # using sort to sort numerator value within file to find target numerator value (i.e., smallest & largest)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s