|
|
A004641
|
|
Fixed under 0 -> 10, 1 -> 100.
|
|
22
|
|
|
1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Write w(n) = a(n) for n >= 1. Each w(n) is generated by w(i) for exactly one i <= n; let g(n) = i. Each w(i) generates a single 1, in a word (10 or 100) that starts with 1. Therefore, g(n) is the number of 1s among w(1), ..., w(n), so that g = A088462. That is, this sequence is generated by its partial sums. - Clark Kimberling, May 25 2011
|
|
LINKS
|
C. J. Glasby, S. P. Glasby, and F. Pleijel, Worms by number, Proc. Roy. Soc. B, Proc. Biol. Sci. 275 (1647) (2008) 2071-2076.
|
|
FORMULA
|
a(n) = floor(n*(sqrt(2) - 1) + sqrt(1/2)) - floor((n - 1)*(sqrt(2) - 1) + sqrt(1/2)) (from the de Bruijn reference). - Peter J. Taylor, Mar 26 2015
|
|
MAPLE
|
P(0):= (1, 0): P(1):= (1, 0, 0):
((P~)@@6)([1]);
# in Maple 12 or earlier, comment the above line and uncomment the following:
|
|
MATHEMATICA
|
Nest[ Flatten[# /. {0 -> {1, 0}, 1 -> {1, 0, 0}}] &, {1}, 5] (* Robert G. Wilson v, May 25 2011 *)
SubstitutionSystem[{0->{1, 0}, 1->{1, 0, 0}}, {1}, 5]//Flatten (* Harvey P. Dale, Nov 20 2021 *)
|
|
PROG
|
(Magma) [Floor(n*(Sqrt(2) - 1) + Sqrt(1/2)) - Floor((n - 1)*(Sqrt(2) - 1) + Sqrt(1/2)): n in [0..100]]; // Vincenzo Librandi, Mar 27 2015
(Python)
from math import isqrt
def A004641(n): return [1, 0, 0, 1, 0, 1, 0, 1][n-1] if n < 9 else -1-isqrt(m:=(n-9)*(n-9)<<1)+isqrt(m+(n-9<<2)+2) # Chai Wah Wu, Aug 25 2022
|
|
CROSSREFS
|
Characteristic function of A086377.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A000201 as the parent: A000201, A001030, A001468, A001950, A003622, A003842, A003849, A004641, A005614, A014675, A022342, A088462, A096270, A114986, A124841. - N. J. A. Sloane, Mar 11 2021
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|