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.

A039996 Number of distinct primes embedded in prime(n) as substrings.

This page as a plain text file.
%I A039996 #30 Jul 29 2025 17:58:34
%S A039996 1,1,1,1,1,2,2,1,3,2,2,3,1,2,2,3,2,1,2,2,3,2,2,1,2,1,2,2,1,4,3,4,5,3,
%T A039996 1,2,3,2,3,5,4,1,2,3,4,2,3,4,3,3,4,4,3,3,4,3,2,4,3,2,4,4,3,4,4,5,3,4,
%U A039996 4,2,4,4,4,5,5,3,3,4,1,1,3,2,4,3,3,3,1,3,2,2,3,4,2,1,1,3,2,3,5,3,4,3,3,2,4
%N A039996 Number of distinct primes embedded in prime(n) as substrings.
%H A039996 David A. Corneth, <a href="/A039996/b039996.txt">Table of n, a(n) for n = 1..10000</a>
%F A039996 a(n) = A039997(prime(n)).
%F A039996 a(n) <= A039994(n). - _Charles R Greathouse IV_, Apr 22 2015
%F A039996 a(n) = A079066(n) + 1. - _Alois P. Heinz_, Jul 29 2025
%e A039996 a(26) = 1 since the only prime substring of "101" is 101.
%e A039996 a(48) = 4 since the only distinct prime substrings of "223" are 2, 3, 23, 223. - _David A. Corneth_, Jul 06 2020
%p A039996 a:= n-> (s-> nops(select(t -> t[1]<>"0" and isprime(parse(t)),
%p A039996         {seq(seq(s[i..j], i=1..j), j=1..length(s))})))(""||(ithprime(n))):
%p A039996 seq(a(n), n=1..105);  # _Alois P. Heinz_, Jul 29 2025
%t A039996 f[n_] := Block[{id = IntegerDigits@ Prime@n, len = Floor[ Log[10, Prime@n] + 1]}, Count[ PrimeQ@ Union[ FromDigits@# & /@ Flatten[ Table[ Partition[id, k, 1], {k, len}], 1]], True]]; Array[f, 105] (* _Robert G. Wilson v_, Jun 28 2010 *)
%o A039996 (PARI) dp(n)=if(n<12, return(if(isprime(n), [n], []))); my(v=vecsort(select(isprime, eval(Vec(Str(n)))), , 8), t); while(n>9, if(gcd(n%10, 10)>1, n\=10; next); t=10; while((t*=10)<n*10, if(isprime(n%t), v=concat(v, n%t))); v=vecsort(v, , 8); n\=10); v
%o A039996 a(n)=#dp(prime(n)) \\ _Charles R Greathouse IV_, Apr 22 2015
%Y A039996 Cf. A039994, A079066, A178597.
%K A039996 nonn,base
%O A039996 1,6
%A A039996 _David W. Wilson_
%E A039996 Name corrected by _David A. Corneth_, Jul 06 2020