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.

A071649 Sum of odd decimal digits of n.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Reinhard Zumkeller, May 28 2002

Keywords

Crossrefs

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

Programs

  • Maple
    A071649 := proc(n)
          local a,d;
          a := 0 ;
          for d in convert(n,base,10) do
            if type(d,'odd') then
                a := a+d ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Feb 02 2015
  • Mathematica
    Table[Total[Select[IntegerDigits[n], OddQ[#] &]],{n,92}] (* Jayanta Basu, May 23 2013 *)
  • PARI
    a(n)=my(d=digits(n)); sum(i=1,#d,if(d[i]%2,d[i])) \\ Charles R Greathouse IV, Apr 04 2014
    
  • PARI
    A071649(n)=vecsum(select(d->bittest(d,0), digits(n))) \\ Nearly twice as fast. - M. F. Hasler, Dec 09 2018
    
  • Python
    A071649 = lambda x: sum(d for d in map(int, str(x)) if d&1) # M. F. Hasler, Dec 07 2022

Formula

a(n) = 0 iff n is in A014263. - Bernard Schott, Mar 17 2023