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-10 of 20 results. Next

A006368 The "amusical permutation" of the nonnegative numbers: a(2n)=3n, a(4n+1)=3n+1, a(4n-1)=3n-1.

Original entry on oeis.org

0, 1, 3, 2, 6, 4, 9, 5, 12, 7, 15, 8, 18, 10, 21, 11, 24, 13, 27, 14, 30, 16, 33, 17, 36, 19, 39, 20, 42, 22, 45, 23, 48, 25, 51, 26, 54, 28, 57, 29, 60, 31, 63, 32, 66, 34, 69, 35, 72, 37, 75, 38, 78, 40, 81, 41, 84, 43, 87, 44, 90, 46, 93, 47, 96, 49, 99, 50, 102, 52, 105, 53
Offset: 0

Views

Author

Keywords

Comments

A permutation of the nonnegative integers.
There is a famous open question concerning the closed trajectories under this map - see A217218, A028393, A028394, and Conway (2013).
This is lodumo_3 of A131743. - Philippe Deléham, Oct 24 2011
Multiples of 3 interspersed with numbers other than multiples of 3. - Harvey P. Dale, Dec 16 2011
For n>0: a(2n+1) is the smallest number missing from {a(0),...,a(2n-1)} and a(2n) = a(2n-1) + a(2n+1). - Bob Selcoe, May 24 2017
From Wolfdieter Lang, Sep 21 2021: (Start)
The permutation P of positive natural numbers with P(n) = a(n-1) + 1, for n >= 1, is the inverse of the permutation given in A265667, and it maps the index n of A178414 to the index of A047529: A178414(n) = A047529(P(n)).
Thus each number {1, 3, 7} (mod 8) appears in the first column A178414 of the array A178415 just once. For the formulas see below. (End)
Starting at n = 1, the sequence equals the smallest unused positive number such that a(n)-a(n-1) does not appear as a term in the current sequence. - Scott R. Shannon, Dec 20 2023

Examples

			9 is odd so a(9) = round(3*9/4) = round(7-1/4) = 7.
		

References

  • J. H. Conway, Unpredictable iterations, in Proc. Number Theory Conf., Boulder, CO, 1972, pp. 49-52.
  • R. K. Guy, Unsolved Problems in Number Theory, E17.
  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 5.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006368 n | u' == 0   = 3 * u
              | otherwise = 3 * v + (v' + 1) `div` 2
              where (u,u') = divMod n 2; (v,v') = divMod n 4
    -- Reinhard Zumkeller, Apr 18 2012
    
  • Magma
    [n mod 2 eq 1 select Round(3*n/4) else 3*n/2: n in [0..80]]; // G. C. Greubel, Jan 03 2024
  • Maple
    f:=n-> if n mod 2 = 0 then 3*n/2 elif n mod 4 = 1 then (3*n+1)/4 else (3*n-1)/4; fi; # N. J. A. Sloane, Jan 21 2011
    A006368:=(1+3*z+z**2+3*z**3+z**4)/(1+z**2)/(z-1)**2/(1+z)**2; # [Conjectured (correctly, except for the offset) by Simon Plouffe in his 1992 dissertation.]
  • Mathematica
    Table[If[EvenQ[n],(3n)/2,Floor[(3n+2)/4]],{n,0,80}] (* or *) LinearRecurrence[ {0,1,0,1,0,-1},{0,1,3,2,6,4},80] (* Harvey P. Dale, Dec 16 2011 *)
  • PARI
    a(n)=(3*n+n%2)\(2+n%2*2)
    
  • PARI
    a(n)=if(n%2,round(3*n/4),3*n/2)
    
  • Python
    def a(n): return 0 if n == 0 else 3*n//2 if n%2 == 0 else (3*n+1)//4
    print([a(n) for n in range(72)]) # Michael S. Branicky, Aug 12 2021
    

Formula

If n even, then a(n) = 3*n/2, otherwise, a(n) = round(3*n/4).
G.f.: x*(1+3*x+x^2+3*x^3+x^4)/((1-x^2)*(1-x^4)). - Michael Somos, Jul 23 2002
a(n) = -a(-n).
From Reinhard Zumkeller, Nov 20 2009: (Start)
a(n) = A006369(n) - A168223(n).
A168221(n) = a(a(n)).
A168222(a(n)) = A006369(n). (End)
a(n) = a(n-2) + a(n-4) - a(n-6); a(0)=0, a(1)=1, a(2)=3, a(3)=2, a(4)=6, a(5)=4. - Harvey P. Dale, Dec 16 2011
From Wolfdieter Lang, Sep 21 2021: (Start)
Formulas for the permutation P(n) = a(n-1) + 1 mentioned above:
P(n) = n + floor(n/2) if n is odd, and n - floor(n/4) if n is even.
P(n) = (3*n-1)/2 if n is odd; P(n) = (3*n+2)/4 if n == 2 (mod 4); and P(n) = 3*n/4 if n == 0 (mod 4). (End)

Extensions

Edited by Michael Somos, Jul 23 2002
I replaced the definition with the original definition of Conway and Guy. - N. J. A. Sloane, Oct 03 2012

A006369 a(n) = 2*n/3 for n divisible by 3, otherwise a(n) = round(4*n/3). Or, equivalently, a(3*n-2) = 4*n-3, a(3*n-1) = 4*n-1, a(3*n) = 2*n.

Original entry on oeis.org

0, 1, 3, 2, 5, 7, 4, 9, 11, 6, 13, 15, 8, 17, 19, 10, 21, 23, 12, 25, 27, 14, 29, 31, 16, 33, 35, 18, 37, 39, 20, 41, 43, 22, 45, 47, 24, 49, 51, 26, 53, 55, 28, 57, 59, 30, 61, 63, 32, 65, 67, 34, 69, 71, 36, 73, 75, 38, 77, 79, 40, 81, 83, 42, 85, 87, 44, 89, 91, 46, 93, 95
Offset: 0

Views

Author

Keywords

Comments

Original name was: Nearest integer to 4n/3 unless that is an integer, when 2n/3.
This function was studied by Lothar Collatz in 1932.
Fibonacci numbers lodumo_2. - Philippe Deléham, Apr 26 2009
a(n) = A006368(n) + A168223(n); A168222(n) = a(a(n)); A168221(a(n)) = A006368(n). - Reinhard Zumkeller, Nov 20 2009
The permutation P given in A265667 is P(n) = a(n-1) + 1, for n >= 0, with a(-1) = -1. Observed by Kevin Ryde. - Wolfdieter Lang, Sep 22 2021

Examples

			G.f. = x + 3*x^2 + 2*x^3 + 5*x^4 + 7*x^5 + 4*x^6 + 9*x^7 + 11*x^8 + 6*x^9 + ...
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E17.
  • M. Klamkin, ed., Problems in Applied Mathematics: Selections from SIAM Review, SIAM, 1990; see pp. 579-581.
  • K. Knopp, Infinite Sequences and Series, Dover Publications, NY, 1958, p. 77.
  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 31 (g(n)) and page 270 (f(n)).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006369 n | m > 0     = round (4 * fromIntegral n / 3)
              | otherwise = 2 * n' where (n',m) = divMod n 3
    -- Reinhard Zumkeller, Dec 31 2011
  • Maple
    A006369 := proc(n) if n mod 3 = 0 then 2*n/3 else round(4*n/3); fi; end;
    f:=proc(N) if N mod 3 = 0 then 2*(N/3); elif N mod 3 = 2 then 4*((N+1)/3)-1; else 4*((N+2)/3)-3; fi; end; # N. J. A. Sloane, Feb 04 2011
    A006369:=(1+z**2)*(z**2+3*z+1)/(z-1)**2/(z**2+z+1)**2; # Simon Plouffe, in his 1992 dissertation
  • Mathematica
    Table[If[Divisible[n,3],(2n)/3,Floor[(4n)/3+1/2]],{n,0,80}] (* Harvey P. Dale, Nov 03 2011 *)
    Table[n + Floor[(n + 1)/3] (-1)^Mod[n + 1, 3], {n, 0, 80}] (* Bruno Berselli, Dec 10 2015 *)
  • PARI
    {a(n) = if( n%3, round(4*n / 3), 2*n / 3)}; /* Michael Somos, Oct 05 2003 */
    

Formula

From Michael Somos, Oct 05 2003: (Start)
G.f.: x * (1 + 3*x + 2*x^2 + 3*x^3 + x^4) / (1 - x^3)^2.
a(3*n) = 2*n, a(3*n + 1) = 4*n + 1, a(3*n - 1) = 4*n - 1, a(n) = -a(-n) for all n in Z. (End)
The map is: n -> if n mod 3 = 0 then 2*n/3 elif n mod 3 = 1 then (4*n-1)/3 else (4*n+1)/3.
a(n) = (2 - ((2*n + 1) mod 3) mod 2) * floor((2*n + 1)/3) + (2*n + 1) mod 3 - 1. - Reinhard Zumkeller, Jan 23 2005
a(n) = lod_2(F(n)). - Philippe Deléham, Apr 26 2009
0 = 21 + a(n)*(18 + 4*a(n) - a(n+1) - 7*a(n+2)) + a(n+1)*(-a(n+2)) + a(n+2)*(-18 + 4*a(n+2)) for all n in Z. - Michael Somos, Aug 24 2014
a(n) = n + floor((n+1)/3)*(-1)^((n+1) mod 3). - Bruno Berselli, Dec 10 2015
a(n) = 2*a(n-3) - a(n-6) for n >= 6. - Werner Schulte, Mar 16 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = log(sqrt(2)+2)/sqrt(2) + (1-sqrt(2)/2)*log(2)/2. - Amiram Eldar, Sep 29 2022

Extensions

New name from Jon E. Schoenfield, Jul 28 2015

A028393 Iterate the map in A006368 starting at 8.

Original entry on oeis.org

8, 12, 18, 27, 20, 30, 45, 34, 51, 38, 57, 43, 32, 48, 72, 108, 162, 243, 182, 273, 205, 154, 231, 173, 130, 195, 146, 219, 164, 246, 369, 277, 208, 312, 468, 702, 1053, 790, 1185, 889, 667, 500, 750, 1125, 844, 1266, 1899, 1424, 2136, 3204, 4806, 7209, 5407
Offset: 0

Views

Author

Keywords

Comments

It is conjectured that this trajectory never repeats, but no proof of this has been found. - N. J. A. Sloane, Jul 14 2009

References

  • J. H. Conway, Unpredictable iterations, in Proc. Number Theory Conf., Boulder, CO, 1972, pp. 49-52. - N. J. A. Sloane, Oct 04 2012
  • R. K. Guy, Unsolved Problems in Number Theory, E17. - N. J. A. Sloane, Oct 04 2012
  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 5. [From N. J. A. Sloane, Jan 21 2011]

Crossrefs

Programs

  • Haskell
    a028393 n = a028393_list !! n
    a028393_list = iterate a006368 8  -- Reinhard Zumkeller, Apr 18 2012
    
  • Maple
    F := proc(n) option remember; if n = 0 then 8 elif 3*F(n-1) mod 2 = 0 then 3*F(n-1)/2 else round(3*F(n-1)/4); fi; end; [ seq(F(i),i=0..80) ];
  • Mathematica
    f[n_?EvenQ] := 3*n/2; f[n_] := Round[3*n/4]; a[0] = 8; a[n_] := a[n] = f[a[n - 1]]; Table[a[n], {n, 0, 52}]  (* Jean-François Alcover, Jun 10 2013 *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def F(n):
        if n == 0: return 8
        elif 3*F(n-1)%2 == 0: return 3*F(n-1)//2
        else: return (3*F(n-1)+1)//4
    print([F(i) for i in range(81)]) # Michael S. Branicky, Aug 12 2021 after J. H. Conway

Formula

a(n+1) = A006368(a(n)).

A028394 Iterate the map in A006369 starting at 8.

Original entry on oeis.org

8, 11, 15, 10, 13, 17, 23, 31, 41, 55, 73, 97, 129, 86, 115, 153, 102, 68, 91, 121, 161, 215, 287, 383, 511, 681, 454, 605, 807, 538, 717, 478, 637, 849, 566, 755, 1007, 1343, 1791, 1194, 796, 1061, 1415, 1887, 1258, 1677, 1118, 1491, 994, 1325, 1767, 1178
Offset: 0

Views

Author

Keywords

Comments

It is an unsolved problem to determine if this sequence is bounded or unbounded.

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 270.

Crossrefs

Programs

  • Haskell
    a028394 n = a028394_list !! n
    a028394_list = iterate a006369 8  -- Reinhard Zumkeller, Dec 31 2011
  • Maple
    G := proc(n) option remember; if n = 0 then 8 elif 4*G(n-1) mod 3 = 0 then 2*G(n-1)/3 else round(4*G(n-1)/3); fi; end; [ seq(G(i),i=0..80) ];
    f:=proc(N) local n;
    if N mod 3 = 0 then 2*(N/3);
    elif N mod 3 = 2 then 4*((N+1)/3)-1; else
    4*((N+2)/3)-3; fi; end; # N. J. A. Sloane, Feb 04 2011
  • Mathematica
    nxt[n_]:=Module[{m=Mod[n,3]},Which[m==0,(2n)/3,m==1,(4n-1)/3,True,(4n+1)/3]]; NestList[nxt,8,60] (* Harvey P. Dale, Dec 13 2013 *)
    SubstitutionSystem[{n_ :> Switch[Mod[n, 3], 0, 2n/3, 1, (4n-1)/3, , (4n+1)/3 ] }, {8}, 60] // Flatten (* _Jean-François Alcover, Mar 01 2019 *)

Formula

The map is: n -> if n mod 3 = 0 then 2*n/3 elif n mod 3 = 1 then (4*n-1)/3 else (4*n+1)/3.

A094329 Iterate the map in A006369 starting at 16.

Original entry on oeis.org

16, 21, 14, 19, 25, 33, 22, 29, 39, 26, 35, 47, 63, 42, 28, 37, 49, 65, 87, 58, 77, 103, 137, 183, 122, 163, 217, 289, 385, 513, 342, 228, 152, 203, 271, 361, 481, 641, 855, 570, 380, 507, 338, 451, 601, 801, 534, 356, 475, 633, 422, 563, 751, 1001, 1335, 890, 1187, 1583
Offset: 1

Views

Author

N. J. A. Sloane, Jun 04 2004

Keywords

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 270.

Crossrefs

Programs

A180853 Trajectory of 4 under map n->A006368(n).

Original entry on oeis.org

4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5, 4, 6, 9, 7, 5
Offset: 0

Views

Author

N. J. A. Sloane, Jan 22 2011

Keywords

Comments

The trajectory of 8 is a famous unsolved problem - see A028393.

References

  • D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 16.

Crossrefs

Programs

Formula

Periodic with period of length 5.
G.f.: ( -4-6*x-9*x^2-7*x^3-5*x^4 ) / ( (x-1)*(1+x+x^2+x^3+x^4) ). - R. J. Mathar, Mar 10 2011
a(n+1) = A006368(a(n)).
a(n) = a(n-5). - Wesley Ivan Hurt, Apr 26 2021

A185589 Iterate the map in A006369 starting at 144.

Original entry on oeis.org

144, 96, 64, 85, 113, 151, 201, 134, 179, 239, 319, 425, 567, 378, 252, 168, 112, 149, 199, 265, 353, 471, 314, 419, 559, 745, 993, 662, 883, 1177, 1569, 1046, 1395, 930, 620, 827, 1103, 1471, 1961, 2615, 3487, 4649, 6199, 8265, 5510, 7347, 4898, 6531, 4354, 5805, 3870, 2580, 1720, 2293, 3057, 2038, 2717, 3623, 4831
Offset: 1

Views

Author

N. J. A. Sloane, Feb 04 2011

Keywords

Comments

Lagarias, page 270, appears to imply that this trajectory has period 12 and smallest element 144, which is not true.

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 270.

Crossrefs

Programs

A185590 Iterate the map in A006369 starting at 44.

Original entry on oeis.org

44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44, 59, 79, 105, 70, 93, 62, 83, 111, 74, 99, 66, 44
Offset: 1

Views

Author

N. J. A. Sloane, Feb 04 2011

Keywords

Comments

Periodic with period length 12.

References

  • A. O. L. Atkin, Comment on Problem 63-13, SIAM Rev., 8 (1966), 234-236.
  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010; see page 270. (beware of typo: Lagarias says the orbit of 144 (not 44) has period 12.)

Crossrefs

Programs

  • Haskell
    a185590 n = a185590_list !! (n-1)
    a185590_list = iterate a006369 44  -- Reinhard Zumkeller, Dec 31 2011
  • Mathematica
    f[n_] := If[Mod[n, 3] == 0, 2*n/3, Round[4*n/3]]; a[1] = 44; a[n_] := a[n] = f[a[n - 1]]; Table[a[n], {n, 1, 73}] (* Jean-François Alcover, Jun 10 2013 *)

A028396 Iterate the map in A006369 starting at 14.

Original entry on oeis.org

14, 19, 25, 33, 22, 29, 39, 26, 35, 47, 63, 42, 28, 37, 49, 65, 87, 58, 77, 103, 137, 183, 122, 163, 217, 289, 385, 513, 342, 228, 152, 203, 271, 361, 481, 641, 855, 570, 380, 507, 338, 451, 601, 801, 534, 356, 475, 633, 422, 563, 751, 1001, 1335, 890, 1187
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

A182205 Iterate the map in A006368 starting at 40.

Original entry on oeis.org

40, 60, 90, 135, 101, 76, 114, 171, 128, 192, 288, 432, 648, 972, 1458, 2187, 1640, 2460, 3690, 5535, 4151, 3113, 2335, 1751, 1313, 985, 739, 554, 831, 623, 467, 350, 525, 394, 591, 443, 332, 498, 747, 560, 840, 1260, 1890, 2835, 2126, 3189, 2392, 3588, 5382
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 18 2012

Keywords

Comments

Like for iterations with starting points 8 or 14, it is conjectured that also this trajectory never repeats.

References

  • D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 16.

Crossrefs

Programs

  • Haskell
    a182205 n = a182205_list !! n
    a182205_list = iterate a006368 40
  • Mathematica
    SubstitutionSystem[{n_ :> If[EvenQ[n], 3 n/2, Round[3 n/4]]}, {40}, 60] // Flatten (* Jean-François Alcover, Mar 01 2019 *)

Formula

a(n+1) = A006368(a(n)), with a(0) = 40.
Showing 1-10 of 20 results. Next