Move the last digit and double the number

Check if you can solve the following:

The objective is to find a number which gets doubled when the last digit of the number is moved to the front of the number.

For an example:

Let abcd is the number, it should get doubled when d which is the last digit, is moved to the front, forming dabc 

2 x abcd = dabc

can you find such a number or few numbers?

First I started building the following equation:

Let x is positive integer and y is a single digit.

x > 0 and 10 > y > 0

therefore, the number can be written as;

2 . (10 . x + y ) = (y . 10^p) + x 


x = [ (10^p) – 2 ] * [y / 19]


y = [19 . x ] / [(10^p) – 2 ]

Then after, it is possible to solve this using trail and error method. It is cumbersome, yet possible. I was tying to figure out a heuristic method to get the answer, but I could not. Therefore I though of using a python script to get the answer.

def eqx(n, y):
    return int(((10**n)-(2))*(y/19))

def eqy(n, x):
    return int((19*x)/((10**n)-2))

def num_conv(num1, num2, p):
    d2 = num1%10
    d1 = int(num1/10)
    if(num2==((d2*10**p)+d1) and (10**p<num1)):
        return True
    return False

for i in range(0,300):
    for j in range(0,10):
        x = eqx(i,j)
        y = eqy(i,x)

        num1 = int((10*x)+y)
        num2 = int((y*(10**i))+x)

        LHS = 2*num1
        RHS = num2
        num_shuffled = num_conv(num1,num2,i)
        if ((LHS==RHS) and (num_shuffled) and (x!=0)):
            print (format(num1, ',d'),' shifting last digit ',format(num2, ',d'))
            print ('LHS',format(LHS, ',d'), ' RHS',format(RHS, ',d'))


x,y,p 10526315789473684 2 17
105,263,157,894,736,842 shifting last digit 210,526,315,789,473,684
LHS 210,526,315,789,473,684 RHS 210,526,315,789,473,684

x,y,p 15789473684210526 3 17
157,894,736,842,105,263 shifting last digit 315,789,473,684,210,526
LHS 315,789,473,684,210,526 RHS 315,789,473,684,210,526

x,y,p 21052631578947368 4 17
210,526,315,789,473,684 shifting last digit 421,052,631,578,947,368
LHS 421,052,631,578,947,368 RHS 421,052,631,578,947,368

x,y,p 31578947368421052 6 17
315,789,473,684,210,526 shifting last digit 631,578,947,368,421,052
LHS 631,578,947,368,421,052 RHS 631,578,947,368,421,052

x,y,p 42105263157894736 8 17
421,052,631,578,947,368 shifting last digit 842,105,263,157,894,736
LHS 842,105,263,157,894,736 RHS 842,105,263,157,894,736

Later I found out these kind of numbers are called Parasitic numbers, OEIS sequence of A146088[2][3]. If you are interested, refer to the following Wikipedia article[1] as the starting point.


This article is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported (CC BY-SA 3.0) license. 

Please add your valuable idea below, will make a discussion, thanks !

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