NestWhile

WMA link


NestWhile[f, expr, test]

applies a function f repeatedly on an expression expr, until applying test on the result no longer yields True.

NestWhile[f, expr, test, m]

supplies the last m results to test (default value: 1).

NestWhile[f, expr, test, All]

supplies all results gained so far to test.

Divide by 2 until the result is no longer an integer:

Calculate the sum of third powers of the digits of a number until the
same result appears twice:

Print the intermediate results:

NestList