In this program, a number N will be given by the client and we need to discover the N-th number which is both square and 3D square. Example of certain numbers which are both square and 3D shape are 1, 64, 729, and so on. A straightforward methodology will strike a chord that makes a rundown of numbers which is both square and 3D square and by utilizing the ordering of rundown locate the nth number yet these ways to deal with the arrangement of this issue will take a great deal of time and it might be demonstrated time limit surpassed. Thus, to conquer these issues we will utilize the scientific methodology for taking care of this issue in a straightforward manner which is simply found in the sixth intensity of the given number.
The calculation to take care of this issue:
Take contribution from the client i.e estimation of N.
Discover the N-th intensity of the given number N and dole out it to another variable R.
Print the variable R which is our Nth number.
Along these lines, we should attempt to take care of the issue by the execution of the above calculation in Python.
Program:
N = int(input('Enter the value of N: '))
R = N**6
print('Nth number: ',R)
Output:
RUN 1:
Enter the value of N: 3
Nth number: 729
RUN 2:
Enter the value of N: 2
Nth number: 64
In Python, a twofold bullet (**) is utilized to discover the intensity of a number.
Clarification:
729 is a square of 27 and a block of 9 likewise 64 is a square of 8 and a solid shape of 4. At the point when we check numbers like this in the normal number then we will get a progression of 1, 64,729, 4096, and so on and here 729 is at the third position in the arrangement i.e third number which is both a square and a block.