We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Mathematics
  3. Fundamentals
  4. Summing the N series

Summing the N series

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

There is a sequence whose term is

Evaluate the series


Find .

Example

The series is .

Function Description

Complete the summingSeries function in the editor below.

summingSeries has the following parameter(s):

  • int n: the inclusive limit of the range to sum

Returns

  • int: the sum of the sequence, modulo

Input Format

The first line of input contains , the number of test cases.
Each test case consists of one line containing a single integer .

Constraints

Sample Input 0

2
2
1

Sample Output 0

4
1

Explanation 0

Case 1: We have
Case 2: We have

Author

shashank21j

Difficulty

Medium

Max Score

20

Submitted By

38173

Need Help?


View discussions
View editorial
View top submissions
RESOURCES

  • Closed Form

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature