Mbpp/80

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
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 失败测试用例
  • 无失败测试