A079066 "Memory" of prime(n): the number of distinct (previous) primes contained as substrings in prime(n).
0, 0, 0, 0, 0, 1, 1, 0, 2, 1, 1, 2, 0, 1, 1, 2, 1, 0, 1, 1, 2, 1, 1, 0, 1, 0, 1, 1, 0, 3, 2, 3, 4, 2, 0, 1, 2, 1, 2, 4, 3, 0, 1, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 2, 3, 2, 1, 3, 2, 1, 3, 3, 2, 3, 3, 4, 2, 3, 3, 1, 3, 3, 3, 4, 4, 2, 2, 3, 0, 0, 2, 1, 3, 2, 2, 2, 0, 2, 1, 1, 2, 3, 1, 0, 0, 2, 1, 2, 4, 2, 3, 2, 2, 1, 3
Offset: 1
Examples
The primes contained as substrings in prime(3) = 113 are 3, 11, 13. Hence a(30) = 3. 113 is the smallest prime with memory = 3.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Haskell
import Data.List (isInfixOf) a079066 n = length $ filter (`isInfixOf` (primesDec !! n)) $ take n primesDec primesDec = "_" : map show a000040_list -- Reinhard Zumkeller, Jul 19 2011
-
Maple
a:= n-> (s-> -1+nops(select(t -> t[1]<>"0" and isprime(parse(t)), {seq(seq(s[i..j], i=1..j), j=1..length(s))})))(""||(ithprime(n))): seq(a(n), n=1..105); # Alois P. Heinz, Jul 29 2025
-
Mathematica
ub = 105; tprime = Table[ToString[Prime[i]], {i, 1, ub}]; a = {}; For[i = 1, i <= ub, i++, m = 0; For[j = 1, j < i, j++, If[Length[StringPosition[tprime[[i]], tprime[[j]]]] > 0, m = m + 1]]; a = Append[a, m]]; a
Formula
a(n) = A039997(prime(n)) - 1.
a(n) = A039996(n) - 1. - Alois P. Heinz, Jul 29 2025
Extensions
Edited by Robert G. Wilson v, Feb 25 2003
Name clarified by Sean A. Irvine, Jul 29 2025