|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,6
|
|
COMMENTS
|
|
|
LINKS
|
|
|
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.
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|