OFFSET
1,3
COMMENTS
Iterations are SHA1(SHA1(...(SHA1(160 0 bits)))) with k nestings, and beginning from an input message which is 160 bits all 0.
Each hash digest is 160 bits and is a 160 bit input to the next iteration.
Bit strings are compared lexicographically, which means numerically when interpreted as 160 bit numbers (most to least significant bits).
This is a finite sequence, as there are only a finite number of hash digests (2^160 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 57 terms, due to the underlying hash series forming a cycle. If reached, the expected value (with standard deviation) of a(57) is 2^(~80.4, s.d. ~10.7), on an underlying hash value of 2^160 - 2^(~79.2, s.d. ~10.8).
The first nonzero hash in the series, 0x6768033e216468247bd031a0a2d9876d79818f8f, in base 10 equals 590345609374253065989544892708067078593799360399.
LINKS
Wikipedia, SHA-1.
EXAMPLE
Here 0x... notation shows hexadecimal representations of 160-bit strings, which strings are what pass as arguments and return values of the SHA1 function, interpreted numerically in digit order most to least significant for sorting purposes. The first few iterations are:
k = 0: 0x0000000000000000000000000000000000000000; record, a(1) = 0.
k = 1: 0x6768033e216468247bd031a0a2d9876d79818f8f; record, a(2) = 1.
k = 2: 0x24d5d1ed739e0825bc6d9d44a7dd0d720454eafa, smaller than the prevailing record.
...
k = 6: 0xd5f16da580cc7107fea67f68ca9cf1af8f8e4534; record, a(3) = 6.
...
k = 12: 0xe225aed4ce77008d3b6419ad219149bfcfd92c37; record, a(4) = 12.
PROG
(Perl) use bigint; use Digest::SHA qw(sha1); $_="\x00" x length(sha1); my $r=-1; for(my $k=0; $k<=100000; $k++) {my $t=hex(unpack("H*", $_)); if ($t>$r) {print "$k\n"; $r=$t; } $_=sha1($_); }
(Python)
from hashlib import sha1
from itertools import count, islice
def agen(): # generator of terms
x, record = (0).to_bytes(20), b""
yield 0
for k in count(1):
x = sha1(x).digest()
if x > record:
record = x
yield k
print(list(islice(agen(), 22))) # Michael S. Branicky, Feb 22 2026
CROSSREFS
KEYWORD
nonn,fini
AUTHOR
Charles L. Hohn, Feb 22 2026
STATUS
approved
