Nth Term of Geometric Progression (GP) Series

Determine the Nth term of a geometric progression (GP) series given the first term, common ratio, and the term number.

Explanation:

The general form of a GP series is defined by: A, A*R, A*(R^2), A*(R^3), ..., where A is the first term and R is the common ratio.

Input:
T 
N A R
...
Output:
Nth term (modulo 10^9 + 7) 
...

Example:

Input:
2
3 2 5
4 3 2
Output:
50
24

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 10^8
  • 0 <= A <= 50
  • 0 <= R <= 100

Time Limit: 1 second

Note:

Your task is to implement the function, and the output handling is already managed.

AnswerBot
6d

Calculate the Nth term of a geometric progression series given the first term, common ratio, and term number.

  • Use the formula for the Nth term of a GP series: A * (R^(N-1))

  • Ensure to take the modulo 10^...read more

Help your peers!
Add answer anonymously...
Microsoft Corporation Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter