login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Please make a donation to keep the OEIS running. In 2018 we replaced the server with a faster one, added 20000 new sequences, and reached 7000 citations (often saying "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A118967 If n doesn't occur among the first (n-1) terms of the sequence, then a(n) = 2n. If n occurs among the first (n-1) terms of the sequence, then a(n) = n/2. 2
1, 4, 6, 2, 10, 3, 14, 16, 18, 5, 22, 24, 26, 7, 30, 8, 34, 9, 38, 40, 42, 11, 46, 12, 50, 13, 54, 56, 58, 15, 62, 64, 66, 17, 70, 72, 74, 19, 78, 20, 82, 21, 86, 88, 90, 23, 94, 96, 98, 25, 102, 104, 106, 27, 110, 28, 114, 29, 118, 120, 122, 31, 126, 32, 130, 33, 134, 136 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Sequence is a permutation of the positive integers. It also is its own inverse (i.e. a(a(n)) = n).

From Carl R. White, Aug 23 2010: (Start)

Powers of two with even exponent exchange places with the next lowest power of two with odd exponent and vice versa, i.e., 4 swaps with 2, 256 with 128, etc.

For other numbers where n > 1, the even component (the power of two in n's prime factorization) is exchanged the opposite way: A power of two with _odd_ component is exchanged for the next lowest (even exponent) power of two and vice versa. (End)

LINKS

Table of n, a(n) for n=1..68.

FORMULA

From Carl R. White, Aug 23 2010: (Start)

a(1) = 1;

a(2^m) = 2^(m-(-1)^m), m > 0;

a(k*2^m) = k*2^(m+(-1)^m), m > 0, odd k > 1. (End)

EXAMPLE

a(6) = 2^1*3 -> 2^0*3 = 3; a(12) = 2^2*3 -> 2^3*3 = 24; a(25)=2^0*25 -> 2^1*25 = 50; a(1024) = 2^10 -> 2^9 = 512; a(5120) = 2^10*5 -> 2^11*5 = 10240. - Carl R. White, Aug 23 2010

MATHEMATICA

f[s_] := Block[{n = Length@s}, Append[s, If[ MemberQ[s, n], n/2, 2n]]]; Drop[ Nest[f, {1}, 70], {2}] (* Robert G. Wilson v, May 16 2006 *)

PROG

(Other) /* GNU bc */ scale=0; 1; for(n=2; n<=100; n++){m=0; for(k=n; !k%2; m++)k/=2; if(k==1){2^(m-(-1)^m)}else{k*2^(m+(-1)^m)}} /* Carl R. White, Aug 23 2010 */

CROSSREFS

Cf. A118966.

Matches A073675 for all non-powers-of-two. - Carl R. White, Aug 23 2010

Sequence in context: A282028 A251561 A159193 * A256508 A059030 A066984

Adjacent sequences:  A118964 A118965 A118966 * A118968 A118969 A118970

KEYWORD

easy,nonn

AUTHOR

Leroy Quet, May 07 2006

EXTENSIONS

More terms from Robert G. Wilson v, May 16 2006

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 December 11 19:37 EST 2018. Contains 318049 sequences. (Running on oeis4.)