cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A349646 Nonnegative integers which produce a record maximum MD5 hash.

Original entry on oeis.org

0, 3, 44, 65, 83, 373, 575, 1126, 12673, 25670, 30268, 30525, 40691, 48240964, 63327632, 298506737, 369490840, 1113434519, 1647703600, 4958115803, 64657664035, 86155378906, 184280298746, 400812644253, 411723964986, 714853066875, 1627993432495, 2607864795784
Offset: 1

Views

Author

Ben Whitmore, Nov 23 2021

Keywords

Comments

a(1) = 0; a(n) is the smallest k such that MD5(k) > MD5(a(n-1)), where integer parameters to MD5 are encoded as base-10 ASCII strings.
If a(1) were defined as 1 instead of 0, the sequence would begin 1, 2, 3, 44, ... and then continue in the same way.
If we assume that MD5 behaves like a random function from N to {0, ..., 2^128-1}, the expected length of this sequence is the harmonic number H(2^128) ~= 89.3.
a(31) > 10^15.

Examples

			a(5) = 83 because MD5("83") = fe9fc289c3ff0af142b6d3bead98a923_16 = 338453431832254946862081270079334951203, which is larger than all previous values MD5("0"), ..., MD5("82").
		

Crossrefs

Record minima: A349647.

Programs

  • Mathematica
    recordsBy[l_, P_] :=
    Module[{max = -Infinity, x, i, recs = {}},
    For[i = 1, i <= Length[l], i++,
      x = P[l[[i]]];
      If[x > max,
       max = x;
       AppendTo[recs, l[[i]]];
      ]
    ];
    recs
    ];
    recordsBy[Range[1000], Hash[ToString[#], "MD5"] &]
  • Python
    from hashlib import md5
    def afind(limit):
        record = ""
        for k in range(limit+1):
            hash = md5(str(k).encode('utf-8')).hexdigest()
            if hash > record:
                print(k, end=", ")
                record = hash
    afind(10**5) # Michael S. Branicky, Nov 24 2021

A366061 Numbers of iterations that produce a record low of the digest of the SHA2-256 hash of the empty string.

Original entry on oeis.org

1, 2, 6, 7, 36, 674, 815, 11621, 449652, 2386324, 2643745, 187894152, 704719562, 1390873253, 1625785299, 3479964180, 6909167935, 12446961112
Offset: 1

Views

Author

DarĂ­o Clavijo, Sep 27 2023

Keywords

Comments

The SHA2-256 algorithm takes inputs of any length but here we are feeding the output of every iteration to the next.

Examples

			a(1) = 1 because 1 iteration sha256("") = hex e3b0...b855 is taken as the first digest and so is a record.
a(2) = 2 is the next term since 2 times nested sha256(...(sha256("")...)) = hex 5df6...9456 is less than the previous record e3b0...b855.
		

Crossrefs

Cf. A365749 (for record highs).
Cf. A349647 (in MD5).

Programs

  • Python
    from itertools import islice
    import hashlib
    def g():
      c, vmin, m = 1, b"\xFF" * 32, b""
      while True:
        if (m:= hashlib.sha256(m).digest()) < vmin:
          vmin = m
          yield c
        c += 1
    print(list(islice(g(), 16)))

Extensions

a(17)-a(18) from Michael S. Branicky, Sep 28 2023
Showing 1-2 of 2 results.