OFFSET
1,3
COMMENTS
Iterations are MD5(MD5(...(MD5(128 0 bits)))) with k nestings, and beginning from an input message which is 128 bits all 0.
Each hash digest is 128 bits and is a 128 bit input to the next iteration.
Bit strings are compared lexicographically, which means numerically when interpreted as 128 bit numbers (most to least significant bits).
This is a finite sequence, as there are only a finite number of hash digests (2^128 of them), but it is not known what maximum hash may be reached, nor when it is reached.
Because hash outputs are probabilistically equivalent to random values, there is a ~1/2 chance of the sequence ending at or before 46 terms, due to the underlying hash series forming a cycle. If reached, the expected value (with standard deviation) of a(46) is 2^(~64.6, s.d. ~9.5), on an underlying hash value of 2^128 - 2^(~63.1, s.d. ~9.7).
The first nonzero hash in the series, 0x4ae71336e44bf9bf79d2752e234818a5, in base 10 equals 99562681977162996006182885104198097061.
For a(27) = 20884436327980, the underlying hash is 0xfffffffffffbfbb5e5f5423502e812e1.
LINKS
Wikipedia, MD5.
EXAMPLE
Here 0x... notation shows hexadecimal representations of 128-bit strings, which strings are what pass as arguments and return values of the MD5 function, interpreted numerically in digit order most to least significant for sorting purposes. The first few iterations are:
k = 0: 0x00000000000000000000000000000000; record, a(1) = 0.
k = 1: 0x4ae71336e44bf9bf79d2752e234818a5; record, a(2) = 1.
k = 2: 0x398d01fdf7934d1292c263d374778e1a, smaller than the prevailing record.
k = 3: 0x7995886059df6dd8a1cef4338aa4118e; record, a(3) = 3.
k = 4: 0x543a5cb14988ac60d7068649d34434f8, smaller than the prevailing record.
k = 5: 0xfbfdd8ae19dd5a531f729e8ec0ab66aa; record, a(4) = 5.
PROG
(Perl) use bigint; use Digest::MD5 qw(md5); $_="\x00" x length(md5); my $r=-1; for(my $k=0; $k<=100000; $k++) {my $t=hex(unpack("H*", $_)); if ($t>$r) {print "$k\n"; $r=$t; } $_=md5($_); }
(Python)
from hashlib import md5
def A393294(n):
if not hasattr(A := A393294, 'msg'):
A.iter, A.max, A.msg, A.terms = 0, b'', (0).to_bytes(16), []
while n > len(A.terms):
while A.max >= A.msg:
A.iter += 1; A.msg = md5(A.msg).digest()
A.max = A.msg; A.terms.append(A.iter)
return A.terms[n-1]
print([A393294(n) for n in range(1, 10)])# M. F. Hasler, Feb 12 2026
CROSSREFS
KEYWORD
nonn,fini,hard
AUTHOR
Charles L. Hohn, Feb 10 2026
STATUS
approved
