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.

Showing 1-6 of 6 results.

A071542 Number of steps to reach 0 starting with n and using the iterated process : x -> x - (number of 1's in binary representation of x).

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25
Offset: 0

Views

Author

Benoit Cloitre, Jun 02 2002

Keywords

Examples

			17 (= 10001 in binary) -> 15 (= 1111) -> 11 (= 1011) -> 8 (= 1000) -> 7 (= 111) -> 4 (= 100) -> 3 (= 11) -> 1 -> 0, hence a(17)=8.
		

Crossrefs

A179016 gives the unique infinite sequence whose successive terms are related by this iterated process (in reverse order). Also, it seems that for n>=0, a(A213708(n)) = a(A179016(n+1)) = n.
A213709(n) = a((2^(n+1))-1) - a((2^n)-1).

Programs

  • Mathematica
    Table[-1 + Length@ NestWhileList[# - DigitCount[#, 2, 1] &, n, # > 0 &], {n, 0, 75}] (* Michael De Vlieger, Jul 16 2017 *)
  • PARI
    for(n=1, 150, s=n; t=0; while(s!=0, t++; s=s-sum(i=1, length(binary(s)), component(binary(s), i))); if(s==0, print1(t, ", "); ); )
    
  • PARI
    a(n)=my(k);while(n,n-=hammingweight(n);k++);k \\ Charles R Greathouse IV, Oct 30 2012
    (MIT/GNU Scheme)
    ;; with memoizing definec-macro:
    (definec (A071542 n) (if (zero? n) n (+ 1 (A071542 (- n (A000120 n)))))) ;; Antti Karttunen, Oct 24 2012

Formula

a(0)=0, a(n) = 1 + A071542(n - A000120(n)). - Antti Karttunen, Oct 24 2012
It seems that a(n) ~ C n/log(n) asymptotically with C = 1.4... (n = 10^6 gives C = 1.469..., n = 10^7 gives C = 1.4614...).

Extensions

Starting offset changed to 0 with a(0) prepended as 0 by Antti Karttunen, Oct 24 2012

A218254 Irregular table, where row n (n >= 0) starts with n, the next term is n-A000120(n), and the successive terms are obtained by repeatedly subtracting the number of 1's in the previous term's binary expansion, until zero is reached, after which the next row starts with one larger n.

Original entry on oeis.org

0, 1, 0, 2, 1, 0, 3, 1, 0, 4, 3, 1, 0, 5, 3, 1, 0, 6, 4, 3, 1, 0, 7, 4, 3, 1, 0, 8, 7, 4, 3, 1, 0, 9, 7, 4, 3, 1, 0, 10, 8, 7, 4, 3, 1, 0, 11, 8, 7, 4, 3, 1, 0, 12, 10, 8, 7, 4, 3, 1, 0, 13, 10, 8, 7, 4, 3, 1, 0, 14, 11, 8, 7, 4, 3, 1, 0, 15, 11, 8, 7, 4, 3, 1, 0
Offset: 0

Views

Author

Nico Brown, Oct 24 2012

Keywords

Examples

			The n-th row (starting indexing from zero) in this irregular table consists of block of length A071542(n)+1: 1,2,3,3,4,4,5,5,... which always ends with zero, as:
0
1,0
2,1,0
3,1,0
4,3,1,0
5,3,1,0
6,4,3,1,0
7,4,3,1,0
The 17th term is 6, which in binary is 110. The 18th term is then 6-2=4.
		

Crossrefs

Cf. A218252, A218253. A213707 gives the positions of zeros (i.e. the ending index of each row). A071542, A000120.
The reversed tails of the rows converge towards A179016.

Programs

  • PARI
    for(n=0,9,k=n;while(k, print1(k", "); k-=hammingweight(k)); print1("0, ")) \\ Charles R Greathouse IV, Oct 30 2012

A213706 Partial sums of A071542.

Original entry on oeis.org

0, 1, 3, 5, 8, 11, 15, 19, 24, 29, 35, 41, 48, 55, 62, 69, 77, 85, 94, 103, 113, 123, 133, 143, 154, 165, 176, 187, 199, 211, 223, 235, 248, 261, 275, 289, 304, 319, 334, 349, 365, 381, 397, 413, 430, 447, 464, 481, 499, 517, 535, 553, 572, 591, 610, 629, 649, 669, 689, 709, 730
Offset: 0

Views

Author

Antti Karttunen, Oct 24 2012

Keywords

Crossrefs

Used to compute A213707. a(n)+1 gives the length of the n-th row in the irregular table A218254.

Formula

a(0)=0, a(n) = a(n-1)+A071542(n)

A219647 Positions of zeros in A219649.

Original entry on oeis.org

0, 2, 5, 9, 13, 18, 23, 29, 36, 43, 51, 59, 67, 76, 85, 95, 105, 115, 126, 137, 148, 160, 172, 185, 198, 211, 225, 239, 253, 268, 283, 298, 314, 330, 347, 364, 382, 400, 418, 437, 456, 475, 495, 515, 535, 556, 577, 599, 621, 643, 666, 689, 712, 735, 759, 784
Offset: 0

Views

Author

Antti Karttunen, Nov 24 2012

Keywords

Crossrefs

Analogous sequence for binary system: A213707, for factorial number system: A219657.

Programs

Formula

a(n) = n+A219646(n).

A219657 Positions of zeros in A219659.

Original entry on oeis.org

0, 2, 5, 8, 12, 16, 21, 26, 32, 38, 44, 50, 57, 64, 71, 78, 86, 94, 102, 110, 119, 128, 137, 146, 156, 166, 177, 188, 199, 210, 222, 234, 246, 258, 271, 284, 297, 310, 324, 338, 352, 366, 381, 396, 411, 426, 441, 456, 472, 488, 504, 520, 537, 554, 571, 588, 606
Offset: 0

Views

Author

Antti Karttunen, Nov 25 2012

Keywords

Crossrefs

Cf. A219656, A219659. Analogous sequence for binary system: A213707, for Zeckendorf expansion: A219647.

Programs

Formula

a(n) = n + A219656(n).

A271911 Number of ways to choose three distinct points from a 2 X n grid so that they form an isosceles triangle.

Original entry on oeis.org

0, 4, 10, 16, 24, 32, 42, 52, 64, 76, 90, 104, 120, 136, 154, 172, 192, 212, 234, 256, 280, 304, 330, 356, 384, 412, 442, 472, 504, 536, 570, 604, 640, 676, 714, 752, 792, 832, 874, 916, 960, 1004, 1050, 1096, 1144, 1192, 1242, 1292, 1344, 1396, 1450, 1504
Offset: 1

Views

Author

N. J. A. Sloane, Apr 24 2016

Keywords

Examples

			n=3: Label the points
1 2 3
4 5 6
There are 8 small isosceles triangles like 124 plus 135 and 246, so a(3) = 10.
		

Crossrefs

Row 2 of A271910.
Same start as, but totally different from, 2*A213707.

Programs

  • Mathematica
    LinearRecurrence[{2,0,-2,1},{0,4,10,16},60] (* Harvey P. Dale, May 10 2018 *)

Formula

Conjectured g.f.: 2*x*(2*x^2-x-2)/((x+1)*(x-1)^3). It would be nice to have a proof!
Conjectures from Colin Barker, Apr 24 2016: (Start)
a(n) = (-1+(-1)^n+16*n+2*n^2)/4, or equivalently, a(n) = (n^2+8*n)/2 if n even, (n^2+8*n-1)/2 if n odd.
a(n) = 2*a(n-1)-2*a(n-3)+a(n-4) for n>4. (End)
The conjectured g.f. and recurrence are true. See paper in links. - Chai Wah Wu, May 07 2016
a(n) = round(n*(n/2+3)) - 4. - Bill McEachen, Aug 10 2025

Extensions

More terms from Harvey P. Dale, May 10 2018
Showing 1-6 of 6 results.