login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A182310 a(0)=0, a(n+1) = (a(n) XOR floor(a(n)/2)) + 1, where XOR is the bitwise exclusive-or operator 4
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

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).

Indices of 2^x:

1, 2, 3, 6, 14, 30, 33, 58, 105, 289, 448, 1336, 2180, 3638, 10276, 11615, 25474, 37571, 47630, 222622, 415682, 1070526, 1644318, 3914170, 9009978, 17456326, 23793359, 51506512, 70338437, 97088689, 282721553, 834909201, 1789381480, 1789539559, etc.

floor(100*log2(indices of 2^x)):

0, 100, 158, 258, 380, 490, 504, 585, 671, 817, 880, 1038, 1109, 1182, 1332, 1350, 1463, 1519, 1553, 1776, 1866, 2002, 2064, 2190, 2310, 2405, 2450, 2561, 2606, 2653, 2807, 2963, 3073, 3073, 3220, 3221, 3421, 3504, 3541, 3718, 3791, 3891, 3975, 3999, 4031, 4323, 4433, 4434, 4568

Given a(n), the previous term a(n-1) can be unambiguously reconstructed as in the C program.

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

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

Eric Weisstein's World of Mathematics, XOR

Wikipedia, Bitwise operation XOR

EXAMPLE

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

MATHEMATICA

NestList[BitXor[#, Floor[#/2]]+1&, 0, 70] (* Harvey P. Dale, Apr 18 2015 *)

PROG

(C)

#include <stdio.h>

#include <math.h>

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

CROSSREFS

Sequence in context: A136790 A073158 A035311 * A244591 A299324 A261076

Adjacent sequences:  A182307 A182308 A182309 * A182311 A182312 A182313

KEYWORD

nonn,base

AUTHOR

Alex Ratushnyak, Apr 24 2012

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 29 15:44 EDT 2020. Contains 334704 sequences. (Running on oeis4.)