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.

A102421 To get a(n), start with 2n+1, multiply by 3 and add 1 and divide out any power of 2; then multiply by 3 and subtract 1 and divide out any power of 2.

Original entry on oeis.org

1, 7, 1, 1, 5, 25, 7, 17, 19, 43, 1, 13, 7, 61, 1, 35, 37, 79, 5, 11, 23, 97, 25, 53, 55, 115, 7, 31, 1, 133, 17, 71, 73, 151, 19, 5, 41, 169, 43, 89, 91, 187, 1, 49, 25, 205, 13, 107, 109, 223, 7, 29, 59, 241, 61, 125, 127, 259, 1, 67, 17, 277, 35, 143, 145, 295, 37, 19, 77, 313
Offset: 0

Views

Author

N. J. A. Sloane, based on email from Dan Asimov (dasimov(AT)earthlink.net), Sep 15 2006

Keywords

Comments

"Start with 2n+1, multiply by 3 and add 1 and divide out any power of 2;" is "equivalent to Start with 3n+2, divide out any power of 2;" - David A. Corneth, Aug 22 2020

Examples

			n=1, 2n+1 = 3 -> 10 -> 5; 5 -> 14 ->7 = a(1).
n=17, 2*n+1 = 35 -> 106 ->53; 53 -> 158 -> 79 = a(17).
		

Crossrefs

Programs

  • Maple
    A102421 :=proc(n) local j; j:=3*n+1; while j mod 2 = 0 do j:=j/2; od: j:=3*j-1; while j mod 2 = 0 do j:=j/2; od: j; end proc;
  • Mathematica
    nextx[x_Integer] := Block[{ a = x}, a = 3a + 1; While[EvenQ@a, a /= 2]; a = 3a - 1; While[EvenQ@a, a /= 2]; a]; Table[ nextx[2n + 1], {n, 0, 69}] (* Robert G. Wilson v Sep 20 2006 *)
  • PARI
    a(n) = {n = 3*n + 2; n>>=valuation(n, 2); n = 3*n - 1; n >> valuation(n, 2)} \\ David A. Corneth, Aug 22 2020

Formula

a(n) = A337349(2*n+1). - R. J. Mathar, Aug 24 2020

Extensions

Moved comments to A337349. - R. J. Mathar, Aug 24 2020

A337349 To get a(n), take 3*n+1 and divide out any power of 2; then multiply by 3, subtract 1 and divide out any power of 2.

Original entry on oeis.org

1, 1, 5, 7, 19, 1, 7, 1, 37, 5, 23, 25, 55, 7, 1, 17, 73, 19, 41, 43, 91, 1, 25, 13, 109, 7, 59, 61, 127, 1, 17, 35, 145, 37, 77, 79, 163, 5, 43, 11, 181, 23, 95, 97, 199, 25, 13, 53, 217, 55, 113, 115, 235, 7, 61, 31, 253, 1, 131, 133, 271, 17, 35, 71, 289, 73, 149
Offset: 0

Views

Author

N. J. A. Sloane, based on email from Dan Asimov (dasimov(AT)earthlink.net), Sep 15 2006

Keywords

Comments

When a(x) is iterated, what are the limit cycles? Are there any besides (1) and (17 -> 19 -> 43 -> 97 -> 109 -> 61)?
Up to 1000000000 every number eventually reaches one of those two cycles. In this range, the longest trajectory starts with n=458788881 and takes 193 steps to reach 1. - Christian Boyer (cboyer(AT)club-internet.fr), Sep 16 2006

Crossrefs

Cf. A102421 (bisection), A102423.

Programs

  • Maple
    A337349 := proc(n)
        local a;
        a := 3*n+1;
        while modp(a,2) = 0 do
            a := a/2 ;
        end do:
        a := 3*a-1 ;
        while modp(a,2) = 0 do
            a := a/2 ;
        end do:
        a ;
    end proc: # R. J. Mathar, Aug 24 2020
  • Mathematica
    a[n_] := Module[{k = 3n+1}, k = k/2^IntegerExponent[k, 2]; k = 3k-1; k = k/2^IntegerExponent[k, 2]; k];
    a /@ Range[0, 100] (* Jean-François Alcover, Aug 27 2020 *)

Formula

a(n) = A075677(A067745(n+1)).
a(2*n+1) = A102421(n).

A122563 Start at 2n+1, iterate the map x -> A337349(x); sequence gives the number of iterations to resulting cycle or -1 if the trajectory never cycles.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, based on email from Dan Asimov (dasimov(AT)earthlink.net), Sep 20 2006

Keywords

Comments

Iteration: multiply by 3 and add 1 and divide out any power of 2; then multiply by 3 and subtract 1 and divide out any power of 2.
When a(x) is iterated, what are the limit cycles? Are there any besides {1} and {17 -> 19 -> 43 -> 97 -> 109 -> 61}?

Examples

			The iteration for n=13 is 27->61->17->19->43->97->109->61->... and a(13)=1 step was needed to enter the cycle (at 61).
The iteration for n=30 is 61-> 17->19->43->97->109->61->> and the cycle was already entered at the start, so a(30)=0.
		

Crossrefs

Programs

  • Maple
    A122563 := proc(n)
        local cyc,itr,x ;
        cyc := [] ;
        x := 2*n+1 ;
        while true do
            cyc := [op(cyc),x] ;
            x := A337349(x) ;
            if x in cyc then
                break ;
            end if;
        end do:
        member(x,cyc,'itr') ;
        itr -1 ;
    end proc:
    seq(A122563(n),n=0..101) ; # R. J. Mathar, Aug 26 2020
  • Mathematica
    nextx[x_Integer] := Block[{a = x}, a = 3 a + 1; While[EvenQ@a, a /= 2]; a = 3 a - 1; While[EvenQ@a, a /= 2]; a]; f[n_] := Length@NestWhileList[nextx, n, FreeQ[{1, 17, 19, 43, 97, 109, 61}, #] &] - 1; Table[f[2 n + 1], {n, 0, 101}] (* original program from author corrected as suggested by William P. Orrick, Ray Chandler, Aug 28 2020 *)

Extensions

a(13), a(30),... corrected. - R. J. Mathar, Aug 26 2020
Showing 1-3 of 3 results.