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-3 of 3 results.

A182310 a(0)=0, a(n+1) = (a(n) XOR floor(a(n)/2)) + 1, where XOR is the bitwise exclusive-or operator.

Original entry on oeis.org

0, 1, 2, 4, 7, 5, 8, 13, 12, 11, 15, 9, 14, 10, 16, 25, 22, 30, 18, 28, 19, 27, 23, 29, 20, 31, 17, 26, 24, 21, 32, 49, 42, 64, 97, 82, 124, 67, 99, 83, 123, 71, 101, 88, 117, 80, 121, 70, 102, 86, 126, 66, 100, 87, 125, 68, 103, 85, 128, 193, 162, 244, 143
Offset: 0

Views

Author

Alex Ratushnyak, Apr 24 2012

Keywords

Comments

As n -> infinity, a(n) -> infinity.

Examples

			a(5) = ( a(4) XOR floor(a(4)/2) ) + 1 = (7 XOR 3) + 1 = 4+1 = 5.
		

Crossrefs

Programs

  • C
    #include 
    #include 
    typedef unsigned long long ULL;
    int main(int argc, char **argv) {
      ULL a=0, i=0, p, prev;
      while(1) {
        prev = a,   a = (a^(a/2)) + 1;
      #if 0  // "if 1" to print indices of 2^x
        ++i;
        if ( (i & ((1<<30)-1))==0 )  printf(".");
        if ((a^prev) > prev)
           printf("\n%llu at %llu,  log2: %llu ", a, i, (ULL)(100.0*log2(i)));
      #else
        printf("%llu, ", prev);
      #endif
        // Test reversion:
        p=a-1;
        ULL t=p/2;
        while (t)  p^=t, t/=2;
        if (p!=prev) printf("Reversion failed!"), exit(1);
      }
      return 0;
    }  // from Alex Ratushnyak, Apr 26 2012
    
  • Haskell
    import Data.Bits (xor)
    a182310 n = a182310_list !! n
    a182310_list = 0 : map (+ 1)
       (zipWith xor a182310_list $ map (`div` 2) a182310_list) :: [Integer]
    -- Reinhard Zumkeller, Apr 25 2012
    
  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, 1+
         (t-> Bits[Xor](t, iquo(t, 2)))(a(n-1)))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jun 29 2021
  • Mathematica
    NestList[BitXor[#,Floor[#/2]]+1&,0,70] (* Harvey P. Dale, Apr 18 2015 *)
  • PARI
    terms(n) = my(x=0, i=0); while(i < n, print1(x, ", "); x=bitxor(x, floor(x/2)) + 1; i++)
    /* Print initial 200 terms as follows: */
    terms(200) \\ Felix Fröhlich, Jun 29 2021

Formula

a(n) = A105081(a(n-1)+1). - Jon Maiga, Jun 27 2021

A182418 a(0)=0, a(n+1) = (a(n) XOR floor(a(n)/6)) + 1, where XOR is the bitwise exclusive-or operator.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 14, 13, 16, 19, 17, 20, 24, 29, 26, 31, 27, 32, 38, 33, 37, 36, 35, 39, 34, 40, 47, 41, 48, 57, 49, 58, 52, 61, 56, 50, 59, 51, 60, 55, 63, 54, 64, 75, 72, 69, 79, 67, 73, 70, 78, 68, 80, 94, 82, 96, 113, 100, 117
Offset: 0

Views

Author

Alex Ratushnyak, Apr 27 2012

Keywords

Comments

Para-random values on each interval (2^k,2^(k+1)-1), then jump to the next interval (2^(k+1),2^(k+2)-1).
Floor(100*log_2(indices of 2^x)):
0, 100, 200, 280, 370, 445, 555, 614, 704, 761, 896, 1000, 1088, 1210, 1284, 1389, 1505, 1591, 1677, 1765, 1839, 1968, 2060, 2170, 2250, 2366, 2478, 2606, 2713, 2806, 2857, 2997, 3096, 3193, 3254, 3393, 3487, 3583, 3664, 3741, 3858, 3925, 4073, 4192, 4313, 4394, 4520
Conjecture:
As n -> infinity, a(n) -> infinity.

Crossrefs

Programs

  • C
    #include 
    int main(int argc, char **argv) {
      unsigned long long a=0, prev;
      while(1) {
        prev = a,   a = (a^(a/6)) + 1;
        printf("%llu, ", prev);
      }
      return 0;     // indices of 2^x: see C program of A182310.
    }               // from Alex Ratushnyak, Apr 27 2012
    
  • Mathematica
    NestList[BitXor[#, Quotient[#, 6]] + 1 &, 0, 63] (* Ivan Neretin, Sep 03 2015 *)
  • PARI
    N=100; v=vector(N);
    for (n=1, N-1, v[n+1] = bitxor( v[n], v[n] \ 6 ) + 1 );
    v /* show terms */
    /* Joerg Arndt, Apr 28 2012 */

A182419 a(0)=0, a(n+1) = (a(n) XOR floor(a(n)/8)) + 1, where XOR is the bitwise exclusive-or operator.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 19, 18, 17, 20, 23, 22, 21, 24, 28, 32, 37, 34, 39, 36, 33, 38, 35, 40, 46, 44, 42, 48, 55, 50, 53, 52, 51, 54, 49, 56, 64, 73, 65, 74, 68, 77, 69, 78, 72, 66, 75, 67, 76, 70, 79, 71, 80, 91, 81, 92, 88, 84, 95
Offset: 0

Views

Author

Alex Ratushnyak, Apr 27 2012

Keywords

Comments

Para-random values on each interval (2^k,2^(k+1)-1), then jump to the next interval (2^(k+1),2^(k+2)-1).
Floor(100*log_2(indices of 2^x)):
0, 100, 200, 300, 358, 445, 542, 642, 708, 752, 898, 985, 1042, 1176, 1245, 1319, 1462, 1521, 1588, 1714, 1809, 1906, 1963, 2049, 2149, 2260, 2402, 2481, 2553, 2657, 2770, 2835, 2929, 3004, 3164, 3281, 3346, 3472, 3557, 3646, 3694, 3801, 3935, 4027, 4135, 4214, 4294, 4415
Given a(n), the previous term a(n-1) can be unambiguously reconstructed as in the C program.
As n -> infinity, a(n) -> infinity.

Crossrefs

Programs

  • C
    #include 
    int main(int argc, char **argv) {
      unsigned long long a=0;
      for (int j=0; j<1000; ++j) {
        printf("%llu, ", a);
        a = (a^(a/8)) + 1;
      }
      return 0;     // indices of 2^x: see C program of A182310.
    }               // from Alex Ratushnyak, Apr 27 2012
    
  • PARI
    N=100; v=vector(N);
    for (n=1, N-1, v[n+1] = bitxor( v[n], v[n] \ 8 ) + 1 );
    v /* show terms */
    /* Joerg Arndt, Apr 28 2012 */
Showing 1-3 of 3 results.