login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037888 a(n)=(1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*2^i} is base 2 representation of n and e(i) are digits d(i) in reverse order. 13
0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 3, 2, 2, 1, 3, 2, 1, 0, 2, 1, 2, 1, 1, 0, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 3, 2, 1, 0, 2, 1, 2, 1, 3, 2, 2, 1, 3, 2, 1, 0, 2, 1, 2, 1, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,10

COMMENTS

a(n) = least number of digits for which the change 0->1 in (binary n) yields a palindrome.

a(n) = sum(abs(A030308(n,k)-A030308(n,A070939(n)-k)): k=0..A070939(n)/2-1). - Reinhard Zumkeller, Apr 09 2013

a(n) = sum((A030308(n,k)+A030308(n,A070939(n)-k)) mod 2: k=0..A070939(n)/2-1). - Reinhard Zumkeller, Sep 18 2013

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

MAPLE

a:= proc(n) local r, ad: r:= proc(s) options operator, arrow: [seq(s[nops(s)-j+1], j = 1 .. nops(s))] end proc: ad := proc(s) local i, j: j := 0: for i to nops(s) do if 0 < abs((s-r(s))[i]) then j := j+1 else end if end do: (1/2)*j end proc: ad(convert(n, base, 2)) end proc: seq(a(n), n = 1 .. 90); # Emeric Deutsch, Aug 20 2016

MATHEMATICA

a[n_] := (bits = IntegerDigits[n, 2]; Total[Abs[bits - Reverse[bits]]]/2); Table[a[n], {n, 1, 90}] (* Jean-Fran├žois Alcover, Jan 16 2013 *)

PROG

(PARI)

for(n = 1, 90,

  v = binary(n); s = 0; j = #v;

  for(k=1, #v, s+=abs(v[k]-v[j]); j--);

  s/=2;

  print1(s, ", ")

)

\\ Washington Bomfim, Jan 13 2011

(Haskell)

a037888 n = div (sum $ map abs $ zipWith (-) bs $ reverse bs) 2

   where bs = a030308_row n

-- Reinhard Zumkeller, Apr 09 2013

CROSSREFS

Cf. A064834.

Sequence in context: A220115 A039924 A275346 * A052308 A116510 A128915

Adjacent sequences:  A037885 A037886 A037887 * A037889 A037890 A037891

KEYWORD

nonn,base,nice

AUTHOR

Clark Kimberling

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 31 15:25 EDT 2021. Contains 346374 sequences. (Running on oeis4.)