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.

A236322 Number of (potentially overlapping) occurrences of n in the decimal representation of n^n.

Original entry on oeis.org

1, 0, 0, 0, 1, 3, 0, 0, 1, 1, 2, 0, 0, 0, 0, 2, 1, 0, 2, 0, 2, 0, 0, 1, 2, 0, 0, 1, 0, 0, 2, 2, 2, 0, 3, 1, 1, 0, 1, 0, 1, 1, 1, 0, 3, 1, 0, 1, 1, 1, 1, 2, 2, 1, 0, 1, 1, 0, 1, 3, 2, 0, 1, 1, 0, 2, 0, 0, 0, 0, 1, 0, 1, 1, 2, 5, 2, 1, 2, 0, 3, 3, 2, 1, 0, 1, 0, 0, 0, 0, 5, 1, 3, 4, 2, 2, 1, 1, 10
Offset: 1

Views

Author

Christian Perfect, Jan 22 2014

Keywords

Comments

Differs from A236314 at n=99.

Crossrefs

A049329 lists n where a(n) is nonzero.
Non-overlapping occurrences are counted by A236314.

Programs

  • Mathematica
    a[n_] := Length[StringPosition @@ ToString /@ {n^n, n}]; Array[a, 99] (* Giovanni Resta, Jan 22 2014 *)
  • PARI
    a(n) = my(m=Mod(n,10^#Str(n)));(m==n=n^n)+sum(i=0,1+log(n)/log(10),m==n\=10) \\ - M. F. Hasler, Jan 23 2014
  • Python
    from itertools import count
    def occurrences(string, sub):
        count = start = 0
        while True:
            start = string.find(sub, start) + 1
            if start > 0:
                count+=1
            else:
                return count
    def a(n):
        return occurrences(str(n**n), str(n))