login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A071649 Sum of odd decimal digits of n. 12

%I #28 Mar 17 2023 06:41:51

%S 1,0,3,0,5,0,7,0,9,1,2,1,4,1,6,1,8,1,10,0,1,0,3,0,5,0,7,0,9,3,4,3,6,3,

%T 8,3,10,3,12,0,1,0,3,0,5,0,7,0,9,5,6,5,8,5,10,5,12,5,14,0,1,0,3,0,5,0,

%U 7,0,9,7,8,7,10,7,12,7,14,7,16,0,1,0,3,0,5,0,7,0,9,9,10,9

%N Sum of odd decimal digits of n.

%F a(n) = 0 iff n is in A014263. - _Bernard Schott_, Mar 17 2023

%p A071649 := proc(n)

%p local a,d;

%p a := 0 ;

%p for d in convert(n,base,10) do

%p if type(d,'odd') then

%p a := a+d ;

%p end if;

%p end do:

%p a ;

%p end proc: # _R. J. Mathar_, Feb 02 2015

%t Table[Total[Select[IntegerDigits[n], OddQ[#] &]],{n,92}] (* _Jayanta Basu_, May 23 2013 *)

%o (PARI) a(n)=my(d=digits(n)); sum(i=1,#d,if(d[i]%2,d[i])) \\ _Charles R Greathouse IV_, Apr 04 2014

%o (PARI) A071649(n)=vecsum(select(d->bittest(d,0), digits(n))) \\ Nearly twice as fast. - _M. F. Hasler_, Dec 09 2018

%o (Python)

%o A071649 = lambda x: sum(d for d in map(int, str(x)) if d&1) # _M. F. Hasler_, Dec 07 2022

%Y a(n) = A007953(n) - A071648(n).

%Y Cf. A014263, A071650.

%K nonn,base,easy

%O 1,3

%A _Reinhard Zumkeller_, May 28 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 8 14:00 EDT 2024. Contains 375021 sequences. (Running on oeis4.)