A346979 Count of the prime decimal descendants of n.
83, 63, 23, 22, 23, 11, 29, 23, 3, 4, 54, 1, 9, 14, 6, 7, 3, 4, 7, 40, 0, 4, 19, 15, 8, 7, 10, 14, 5, 6, 2, 7, 0, 16, 9, 11, 12, 13, 4, 1, 34, 1, 8, 14, 5, 1, 13, 5, 5, 16, 6, 0, 9, 0, 24, 4, 6, 19, 2, 9, 25, 16, 0, 7, 4, 4, 3, 11, 2, 7, 7, 4, 1, 15, 2, 8, 8
Offset: 0
Examples
a(4) = 23. The 23 prime decimal descendants of 4 are shown in the tree below. _____ 4__________________________ / | \ 41 ___43______________ 47 / / | \ \ 419 431 433 439 479 / \ / \ / \ 4337 4339 4391 4397 4793 4799 / | \ | | / \ 43391 43397 43399 43913 43973 47933 47939 | 439133 | 4391339
Programs
-
Mathematica
Table[Length@Rest@Flatten[FixedPointList[(b=#;Select[Flatten[(a=#;FromDigits/@(Join[IntegerDigits@a,{#}]&/@If[b=={0},Range@9,{1,3,7,9}]))&/@b],PrimeQ])&,{n}]],{n,0,76}] (* Giorgos Kalogeropoulos, Aug 16 2021 *)
-
Python
from sympy import isprime def p_count(k): global ct; d = [2, 3, 5, 7] if k == 0 else [1, 3, 7, 9] for i in range(4): m = 10*k + d[i] if isprime(m): ct += 1; p_count(m) return ct for n in range(100): ct = 0; print(p_count(n))
Comments