OFFSET
1,2
COMMENTS
Odd digits are 1, 3, 5, 7 and 9. Prime digits are 2, 3, 5 and 7.
EXAMPLE
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.
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 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Juri-Stepan Gerasimov, Feb 11 2009
EXTENSIONS
a(54) corrected by R. J. Mathar, May 15 2010
Example section edited by Jon E. Schoenfield, Feb 14 2019
STATUS
approved