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
4mo

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!
Select
Add answer anonymously...

Top Software Developer Intern Interview Questions Asked at Microsoft Corporation

Q. What were your responsibilities during your internship?
Q. What is the difference between polymorphism and inheritance?
Q. Given a string, reverse the order of characters using standard data structures a...read more
Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits