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.

Previous Showing 11-12 of 12 results.

A283165 a(0) = 0; a(1) = 1; a(2*n) = 2*a(n), a(2*n+1) = 2*a(n) + (-1)^a(n+1).

Original entry on oeis.org

0, 1, 2, 3, 4, 3, 6, 7, 8, 7, 6, 7, 12, 11, 14, 15, 16, 15, 14, 15, 12, 11, 14, 15, 24, 23, 22, 23, 28, 27, 30, 31, 32, 31, 30, 31, 28, 27, 30, 31, 24, 23, 22, 23, 28, 27, 30, 31, 48, 47, 46, 47, 44, 43, 46, 47, 56, 55, 54, 55, 60, 59, 62, 63, 64, 63, 62, 63, 60, 59, 62, 63, 56, 55, 54, 55, 60, 59, 62, 63, 48, 47, 46, 47, 44, 43, 46, 47, 56, 55, 54
Offset: 0

Views

Author

Ilya Gutkovskiy, Mar 02 2017

Keywords

Examples

			a(0) = 0;
a(1) = 1;
a(2) = a(2*1) = 2*a(1) = 2;
a(3) = a(2*1+1) = 2*a(1) + (-1)^a(2) = 2*1 + (-1)^2 = 3;
a(4) = a(2*2) = 2*a(2) = 2*2 = 4;
a(5) = a(2*2+1) = 2*a(2) + (-1)^a(3) = 2*2 + (-1)^3 = 3, etc.
		

Crossrefs

Cf. A023758 (fixed points), A052499 (records), A080100, A087808.

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := If[EvenQ[n], 2 a[n/2], 2 a[(n - 1)/2] + (-1)^a[(n + 1)/2]]; Table[a[n], {n, 0, 90}]
  • PARI
    a(n) = if (n<2, n, if (n%2==0, 2*a(n/2), 2*a((n-1)/2)+(-1)^(a(n+1)/2)));
    tabl(nn)={for (n=0, nn, print1(a(n), ", "); ); };
    tabl(90); \\ Indranil Ghosh, Mar 03 2017
    
  • Python
    def a(n):
        if n<2: return n
        if n%2==0: return 2*a(n//2)
        else: return 2*a((n-1)//2)+(-1)**a((n+1)//2) # Indranil Ghosh, Mar 03 2017

A380358 Numbers whose binary expansion ends with 11 and does not contain adjacent zeros.

Original entry on oeis.org

3, 7, 11, 15, 23, 27, 31, 43, 47, 55, 59, 63, 87, 91, 95, 107, 111, 119, 123, 127, 171, 175, 183, 187, 191, 215, 219, 223, 235, 239, 247, 251, 255, 343, 347, 351, 363, 367, 375, 379, 383, 427, 431, 439, 443, 447, 471, 475, 479, 491, 495, 503, 507, 511, 683
Offset: 1

Views

Author

R. J. Cintra, Jan 22 2025

Keywords

Comments

The numbers in this sequence appear in the conversion of conventional binary numbers to the canonical signed-digit representation.

Examples

			183 is in the sequence because its binary expansion is 10110111.
		

References

  • J. L. Smith and A. Weinberger, "Shortcut Multiplication for Binary Digital Computers", in Methods for High-Speed Addition and Multiplication, National Bureau of Standards Circular 591, Sec. 1, February, 1958, page 21.

Crossrefs

Programs

  • Mathematica
    Select[4*Range[0, 170] + 3, SequencePosition[IntegerDigits[#, 2], {0, 0}] == {} &] (* Amiram Eldar, Feb 05 2025 *)
  • Python
    from itertools import count, islice
    def A380358_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:n&3==3 and not '00' in bin(n),count(max(startvalue,1)))
    A380358_list = list(islice(A380358_gen(),20)) # Chai Wah Wu, Feb 12 2025

Formula

a(n) = 2 * A247648(n) + 1.
From Hugo Pfoertner, Feb 07 2025: (Start)
a(n) = 4*A052499(n) - 1.
a(n) = 4*(A365808(n+1) + 1)/3 - 1.
a(n) = 2*(A365809(n) + 1)/3 - 1. (End)
Previous Showing 11-12 of 12 results.