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.

A104638 Number of odd digits in n-th prime.

This page as a plain text file.
%I A104638 #25 Jul 13 2025 13:41:11
%S A104638 0,1,1,1,2,2,2,2,1,1,2,2,1,1,1,2,2,1,1,2,2,2,1,1,2,2,2,2,2,3,2,3,3,3,
%T A104638 2,3,3,2,2,3,3,2,3,3,3,3,2,1,1,1,2,2,1,2,2,1,1,2,2,1,1,2,2,3,3,3,3,3,
%U A104638 2,2,3,3,2,3,3,2,2,3,1,1,2,1,2,2,2,1,1,2,1,1,1,2,1,2,2,2,2,2,2,2
%N A104638 Number of odd digits in n-th prime.
%C A104638 The only zero is the first term. Sequence is unbounded. - _Zak Seidov_, Jan 12 2016
%C A104638 From _Robert Israel_, Jan 12 2016: (Start)
%C A104638 For any N, the asymptotic density of terms >= N is 1.
%C A104638 On the other hand, a(n) = 2 if prime(n) is in A159352, which is conjectured to be infinite.
%C A104638 Record values: a(2) = 1, a(5) = 2, a(30) = 3, a(187) = 4, a(1346) = 5, a(10545) = 6, a(86538) = 7, a(733410) = 8.
%C A104638 (End)
%H A104638 Robert Israel, <a href="/A104638/b104638.txt">Table of n, a(n) for n = 1..10000</a>
%F A104638 a(n) = A196564(A000040(n)). - _Michel Marcus_, Oct 05 2013
%p A104638 seq(nops(select(type, convert(ithprime(i),base,10),odd)),i=1..100); # _Robert Israel_, Jan 12 2016
%p A104638 # alternative
%p A104638 A104638 := proc(n)
%p A104638     local a,dgs,d ;
%p A104638     ithprime(n) ;
%p A104638     dgs := convert(%,base,10) ;
%p A104638     a := 0 ;
%p A104638     for d in dgs do
%p A104638         a := a+modp(d,2) ;
%p A104638     end do:
%p A104638     a ;
%p A104638 end proc:
%p A104638 seq(A104638(n),n=1..40) ; # _R. J. Mathar_, Jul 13 2025
%t A104638 Table[Count[IntegerDigits[Prime[n]],_?OddQ],{n,100}] (* _Harvey P. Dale_, Jan 22 2012 *)
%t A104638 Table[Total[Mod[IntegerDigits[Prime[n]], 2]], {n, 100}] (* _Vincenzo Librandi_, Jan 13 2016 *)
%o A104638 (PARI) a(n)=vecsum(digits(prime(n)%2)) \\ _Zak Seidov_, Jan 12 2016
%Y A104638 Cf. A104637, A159352.
%Y A104638 Cf. A154764 (1 odd digit), A155071 (2 odd digits), A030096 (all digits odd).
%K A104638 easy,nonn,base
%O A104638 1,5
%A A104638 _Zak Seidov_, Mar 18 2005