A156607 a(n) = number of odd decimal digits of n-th prime + number of prime decimal digits of n-th prime.
1, 2, 2, 2, 2, 3, 3, 2, 3, 2, 3, 4, 1, 2, 2, 4, 3, 1, 2, 3, 4, 3, 2, 1, 3, 2, 3, 3, 2, 4, 4, 4, 5, 4, 2, 4, 5, 3, 3, 5, 4, 2, 3, 4, 4, 3, 3, 4, 4, 3, 5, 4, 2, 4, 5, 3, 2, 4, 5, 2, 3, 4, 4, 4, 5, 5, 5, 6, 4, 3, 6, 5, 4, 6, 5, 4, 3, 5, 1, 1, 2, 2, 3, 4, 3, 2, 1, 4, 1, 2, 2, 3, 2, 2, 2, 4, 3, 4, 5, 3, 4, 6, 4, 3, 5
Offset: 1
Examples
prime(1)= 2 (0 odd digits, 1 prime), so a(1) = 0 + 1 = 1; prime(2)= 3 (1 odd digit, 1 prime), so a(2) = 1 + 1 = 2; prime(3)= 5 (1 odd digit, 1 prime), so a(3) = 1 + 1 = 2; prime(4)= 7 (1 odd digit, 1 prime), so a(4) = 1 + 1 = 2; prime(5)=11 (2 odd digits, 0 prime), so a(5) = 2 + 0 = 2; prime(6)=13 (2 odd digits, 1 prime), so a(6) = 2 + 1 = 3.
Programs
-
Maple
numPdgs := proc(n) local f,d ; f := 0 ; for d in convert(n,base,10) do if d in {2,3,5,7} then f :=f+1; end if; end do; f ; end proc: numOdddgs := proc(n) local f,d ; f := 0 ; for d in convert(n,base,10) do if type(d,'odd') then f :=f+1; end if; end do; f ; end proc: A156607 := proc(n) p := ithprime(n) ; numPdgs(p) + numOdddgs(p) ; end proc: seq(A156607(n),n=1..120) ; # R. J. Mathar, May 15 2010
-
Mathematica
d[n_]:=Module[{idn=IntegerDigits[n]},Count[idn,?OddQ]+Count[ idn, ?PrimeQ]]; d/@Prime[Range[150]] (* Harvey P. Dale, May 16 2014 *)
Extensions
a(54) corrected by R. J. Mathar, May 15 2010
Example section edited by Jon E. Schoenfield, Feb 14 2019
Comments