📜  二阶欧拉数

📅  最后修改于: 2021-05-05 01:42:18             🧑  作者: Mango

d阶欧拉数序列可以表示为

第N个学期

给定整数N。任务是找到给定级数的第N个项。
例子

方法:想法是找到二阶欧拉数的通用项。以下是二阶欧拉数的通用项的计算:

下面是上述方法的实现:

C++
// C++ implementation to
// find N-th term in the series
 
#include 
#include 
using namespace std;
 
// Function to find N-th term
// in the series
void findNthTerm(int n)
{
    cout << pow(2, n) - 2 * n << endl;
}
 
// Driver Code
int main()
{
    int N = 4;
    findNthTerm(N);
 
    return 0;
}


Java
// Java implementation to find
// N-th term in the series
class GFG{
 
// Function to find N-th term
// in the series
static void findNthTerm(int n)
{
    System.out.println(Math.pow(2, n) - 2 * n);
}
 
// Driver code
public static void main(String[] args)
{
    int N = 4;
    findNthTerm(N);
}
}
 
// This code is contributed by Pratima Pandey


Python3
# Python3 implementation to
# find N-th term in the series
 
# Function to find N-th term
# in the series
def findNthTerm(n):
 
    print(pow(2, n) - 2 * n);
 
# Driver Code
N = 4;
findNthTerm(N);
 
# This code is contributed by Code_Mech


C#
// C# implementation to find
// N-th term in the series
using System;
class GFG{
 
// Function to find N-th term
// in the series
static void findNthTerm(int n)
{
    Console.Write(Math.Pow(2, n) - 2 * n);
}
 
// Driver code
public static void Main()
{
    int N = 4;
    findNthTerm(N);
}
}
 
// This code is contributed by Code_Mech


Javascript


输出:
8

参考: OEIS