Telephone Number or Involution Number
Submissions: 71   Accuracy:

22.55%

  Difficulty: Easy   Marks: 2

Given a positive integer n. The task is to find the nth telephone number.
The telephone numbers or the involution numbers are a sequence of integers that count the ways n telephone lines can be connected to each other, where each line can be connected to at most one other line

Telephone numbers also used to derive the number of ways to place n rooks on an n x n chessboard in such a way that no two rooks attack each other, and in such a way that the configuration of the rooks is symmetric under a diagonal reflection of the board.

Input:
The first line of the input contains an integer T denoting the number of test cases. The description of each test case is as follows. Each test case contains a single line with one integer ' N ' for which you have to find the Nth telephone number.

Output:
For each N, output the Nth telephone number. Print under modulo 109 + 7.

Constraints:
1<=T<=100
1<=N<=1000

Example:
Input:

2
4
6
Output:
10
76

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sahil Chhabra
Author: Sahil_Chhabra


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.