The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A303548 For any n > 0 and h > 0, let d_h(n) be the distance from n to the nearest number with Hamming weight at most h; a(n) = Sum_{i > 0} d_i(n). 3
0, 0, 1, 0, 1, 2, 2, 0, 1, 2, 4, 4, 4, 4, 3, 0, 1, 2, 4, 4, 6, 8, 9, 8, 8, 8, 9, 8, 7, 6, 4, 0, 1, 2, 4, 4, 6, 8, 9, 8, 10, 12, 15, 16, 17, 18, 18, 16, 16, 16, 17, 16, 17, 18, 18, 16, 15, 14, 14, 12, 10, 8, 5, 0, 1, 2, 4, 4, 6, 8, 9, 8, 10, 12, 15, 16, 17, 18 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
For any n > 0 and h >= A000120(n), d_h(n) = 0, hence the series in the name contains only finitely many nonzero terms and is well defined.
See also A303545 for a similar sequence.
LINKS
Rémy Sigrist, Colored pin plot of the first 3 * 512 terms (where the color is function of the number h in the term d_h(n))
FORMULA
a(n) = 0 iff n is a power of 2.
Apparently, a(2 * n) = 2 * a(n).
a(n) >= A053646(n) (as d_1 = A053646).
EXAMPLE
For n = 42:
- d_1(n) = |42 - 32| = 10,
- d_2(n) = |42 - 40| = 2,
- d_h(n) = 0 for any h >= 3,
- hence a(42) = 10 + 2 = 12.
PROG
(PARI) a(n) = my (v=0, h=hamming weight(n)); for (d=0, oo, my (o=min(hamming weight(n-d), hamming weight(n+d))); if (o<h, v += d*(h-o); h=o); if (o<=1, return (v)))
CROSSREFS
Sequence in context: A035370 A306706 A163000 * A105524 A221459 A166387
KEYWORD
nonn,base,look
AUTHOR
Rémy Sigrist, Apr 26 2018
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 June 10 01:53 EDT 2024. Contains 373251 sequences. (Running on oeis4.)