login
A236322
Number of (potentially overlapping) occurrences of n in the decimal representation of n^n.
2
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,6
COMMENTS
Differs from A236314 at n=99.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000 (terms 1..999 from Christian Perfect).
MATHEMATICA
a[n_] := Length[StringPosition @@ ToString /@ {n^n, n}]; Array[a, 99] (* Giovanni Resta, Jan 22 2014 *)
PROG
(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))
(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
CROSSREFS
A049329 lists n where a(n) is nonzero.
Non-overlapping occurrences are counted by A236314.
Sequence in context: A262262 A079275 A236314 * A319419 A133574 A133573
KEYWORD
base,nonn
AUTHOR
Christian Perfect, Jan 22 2014
STATUS
approved