测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 397 字符 |
模型生成的代码 (397 字符)
def tetrahedral_number(n):
"""
Return the nth tetrahedral number.
A tetrahedral number is the sum of the first n triangular numbers,
given by the formula: T_n = n * (n + 1) * (n + 2) / 6.
Parameters:
n (int): The position (1-indexed) in the tetrahedral sequence.
Returns:
int: The nth tetrahedral number.
"""
return n * (n + 1) * (n + 2) // 6
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试