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

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037888 a(n) = (1/2)*Sum_{i} |d(i) - e(i)| where Sum_{i} d(i)*2^i is the 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_{k=0..A070939(n)/2-1} abs(A030308(n, k) - A030308(n, A070939(n)-k)). - Reinhard Zumkeller, Apr 09 2013
a(n) = Sum_{k=0..A070939(n)/2-1} ((A030308(n, k) + A030308(n, A070939(n)-k)) mod 2). - Reinhard Zumkeller, Sep 18 2013
LINKS
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: A349218 A364205 A275346 * A052308 A116510 A128915
KEYWORD
nonn,base,nice
AUTHOR
STATUS
approved

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 December 7 05:59 EST 2023. Contains 367630 sequences. (Running on oeis4.)