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.

This page as a plain text file.
%I A236322 #32 May 21 2025 18:38:56
%S A236322 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,
%T A236322 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,
%U A236322 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
%N A236322 Number of (potentially overlapping) occurrences of n in the decimal representation of n^n.
%C A236322 Differs from A236314 at n=99.
%H A236322 Scott R. Shannon, <a href="/A236322/b236322.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..999 from Christian Perfect).
%t A236322 a[n_] := Length[StringPosition @@ ToString /@ {n^n, n}]; Array[a, 99] (* _Giovanni Resta_, Jan 22 2014 *)
%o A236322 (Python)
%o A236322 from itertools import count
%o A236322 def occurrences(string, sub):
%o A236322     count = start = 0
%o A236322     while True:
%o A236322         start = string.find(sub, start) + 1
%o A236322         if start > 0:
%o A236322             count+=1
%o A236322         else:
%o A236322             return count
%o A236322 def a(n):
%o A236322     return occurrences(str(n**n), str(n))
%o A236322 (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
%Y A236322 A049329 lists n where a(n) is nonzero.
%Y A236322 Non-overlapping occurrences are counted by A236314.
%K A236322 base,nonn
%O A236322 1,6
%A A236322 _Christian Perfect_, Jan 22 2014