Geek译为“极客”,不贴切,译为“铁蛋”甚妙!
1 铁蛋·奥纳奇数(Geek Onacci Number)
铁蛋·奥纳奇数(Geek Onacci Number)也称为“极客纳奇”数列。
极客纳奇数列是组合数学中的一个数字序列。
极客纳奇数列的第N项是该数列中其前三项的和,即第(N–1)项、(N–2)项项和第(N–3)项极客纳奇数之和。
2 计算结果
3 源程序(文本格式)
using System;
using System.Collections;
using System.Collections.Generic;
namespace Legalsoft.Truffer.Algorithm
{
public static partial class Algorithm_Gallery
{
public static int Geek_Onacci_Number(int A, int B, int C, int N)
{
int[] arr = new int[N];
arr[0] = A;
arr[1] = B;
arr[2] = C;
for (int i = 3; i < N; i++)
{
arr[i] = arr[i - 1] + arr[i - 2] + arr[i - 3];
}
return arr[N - 1];
}
}
}
POWER BY TRUFFER.CN 50018.COM 315SOFT.COM
4 源程序(代码格式)
using System;
using System.Collections;
using System.Collections.Generic;
namespace Legalsoft.Truffer.Algorithm
{
public static partial class Algorithm_Gallery
{
public static int Geek_Onacci_Number(int A, int B, int C, int N)
{
int[] arr = new int[N];
arr[0] = A;
arr[1] = B;
arr[2] = C;
for (int i = 3; i < N; i++)
{
arr[i] = arr[i - 1] + arr[i - 2] + arr[i - 3];
}
return arr[N - 1];
}
}
}