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.

A045537 Least nontrivial exponent e such that n is a substring of n^e.

Original entry on oeis.org

2, 2, 5, 5, 3, 2, 2, 5, 5, 3, 2, 11, 14, 10, 8, 26, 6, 17, 5, 11, 5, 6, 10, 15, 3, 2, 19, 15, 7, 8, 5, 11, 3, 14, 14, 10, 6, 10, 6, 11, 3, 6, 18, 5, 11, 5, 18, 9, 5, 3, 2, 3, 7, 16, 17, 11, 3, 5, 9, 11, 2, 6, 7, 7, 11, 17, 15, 8, 5, 11, 5, 9, 8, 5, 8, 3, 2, 16, 21, 11, 5, 6, 14, 4, 11, 22, 22, 7
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (isInfixOf)
    a045537 n = 2 + length
       (takeWhile (not . ((show n) `isInfixOf`) . show) $ iterate (* n) (n^2))
    -- Reinhard Zumkeller, Sep 29 2011
    
  • Mathematica
    f[n_] := Block[{k = 2}, While[ StringPosition[ ToString[n^k], ToString[n]] == {}, k++ ]; k]; Table[ f[n], {n, 0, 87}] (* Robert G. Wilson v, May 09 2005 *)
  • PARI
    a(n) = my(s = Str(n), k=2); while (#strsplit(Str(n^k), s) == 1, k++); k; \\ Michel Marcus, Jun 04 2024
    
  • Python
    from itertools import count
    def a(n):
        s = str(n)
        return next(e for e in count(2) if s in str(n**e))
    print([a(n) for n in range(88)]) # Michael S. Branicky, Feb 23 2025

Formula

n^a(n) = A104782(n).