文章提出一种新的算法,选用适当的初始值,则相应地得到贝努利数、多贝努利数以及富比尼多项式等著名数和多项式。研究了该算法的原理,给出并证明了算法生成的无穷阶矩阵的第0列的显式计算公式,以及第0列到第0行的逆变换公式以及生成函数的表示,它们可用于建立恒等式及封闭计算公式。作为应用,得到有关这些著名数和多项式的一些封闭的计算公式以及恒等式。A new algorithm for Bernoulli numbers, Poly-Bernoulli numbers and Fubini polynomials is given by using appropriate initial values in this paper. The principle of the algorithm is discussed, and the explicit formula for the 0-th column of the matrix generated by the algorithm, the inverse transform and their expression by generating funtions from the 0-th column to the 0-th row are given, which can be used to establish identities and closed formulae. As applications some identities and closed formulae for these famous numbers and polynomials are given.