Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What are permuted multiples?

Rukhshan Haroon

The term permuted multiples refers to special numbers that are multiples of the same numeral and are made up of exactly the same digits!

For example, the integers 125874 and 251748 are permuted multiples of each other. This claim is true, as the second number can be obtained by doubling the first one, and both consist of exactly the same digits.

251748 and 125874 are permuted multiples of one another.

In other words, the only difference between these two numbers is the order in which each digit is placed within them.

In probability, we say that the two numbers are mere permutations of each other.

Permutations are different arrangements of the same data set. The order in which the data elements are placed matters.


Find the smallest integer y such that y, 2y, 3y, 4y, 5y, and 6y are permuted multiples of each other.


Here is the solution to this problem. First, we define two functions that help us calculate multiples and subsequently compare these multiples to check if they are permutations of each other or not.

The find_number function runs an infinite while loop, which calls the calculate function seven times. Each time the calculate function is called, it calculates a particular multiple of the original number. It then converts this multiple into a string and stores each character of this string in a list. This list is subsequently sorted, and the sorted arrangement of the individual digits of that multiple is obtained in the form of a string. Finally, this string is returned upon successful execution of the find_number function.

The return values are stored into separate variables in the find number functions, which checks whether or not all the values are identical with the help of an if statement.

Outside of the while loop, we declare a number with a starting value of 1 to bootstrap our program. In case the if statement is false, this number is incremented before the next iteration of the loop begins. In case it is true, the initial number is printed onto the console. This number is our desired value of y. We can see this here:

def calculate(number,x):
	result = number*x                   #calculates multiple
	temp = []											
	for i in range(len(str(result))):	#loop that converts each digit of the number in a list as integers
	temp.sort()							#sorts the list
	s = [str(i) for i in temp]			#converts each element of list to char
	return "".join(s)					#joins elements of the list to form a string
def find_number():
	number = 1							#declaration of initial value of number to bootstrap the program
		onex = calculate(number,1)		
		twox = calculate(number,2)
		threex = calculate(number,3)
		fourx = calculate(number,4)
		fivex = calculate(number,5)
		sixx = calculate(number,6)
		if (onex == twox and twox == threex and threex == fourx and fourx == fivex and fivex == sixx):	#checks if all multiples are equal or not
		number+= 1						#increments value of number
Solution implemented using Python3.




Rukhshan Haroon
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring