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.

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

A178415 Array T(n,k) of odd Collatz preimages read by antidiagonals.

Original entry on oeis.org

1, 3, 5, 9, 13, 21, 7, 37, 53, 85, 17, 29, 149, 213, 341, 11, 69, 117, 597, 853, 1365, 25, 45, 277, 469, 2389, 3413, 5461, 15, 101, 181, 1109, 1877, 9557, 13653, 21845, 33, 61, 405, 725, 4437, 7509, 38229, 54613, 87381, 19, 133, 245, 1621, 2901, 17749, 30037
Offset: 1

Views

Author

T. D. Noe, May 28 2010

Keywords

Comments

Every odd number occurs uniquely in this array. See A178414.

Examples

			Array T begins:
.    1    5   21    85   341   1365    5461   21845    87381   349525
.    3   13   53   213   853   3413   13653   54613   218453   873813
.    9   37  149   597  2389   9557   38229  152917   611669  2446677
.    7   29  117   469  1877   7509   30037  120149   480597  1922389
.   17   69  277  1109  4437  17749   70997  283989  1135957  4543829
.   11   45  181   725  2901  11605   46421  185685   742741  2970965
.   25  101  405  1621  6485  25941  103765  415061  1660245  6640981
.   15   61  245   981  3925  15701   62805  251221  1004885  4019541
.   33  133  533  2133  8533  34133  136533  546133  2184533  8738133
.   19   77  309  1237  4949  19797   79189  316757  1267029  5068117
- _L. Edson Jeffery_, Mar 11 2015
From _Bob Selcoe_, Apr 09 2015 (Start):
n=5, j=13: T(5,3) = 277 = (13*4^3 - 1)/3;
n=6, j=17: T(6,4) = 725 = (17*2^7 - 1)/3.
(End)
		

Crossrefs

Rows of array: -A007583(k-1) (n=0), A002450 (n=1), A072197(k-1) (n=2), A206374(n=3), A072261 (n=4), A323824 (n=5), A072262 (n=6), A330246 (n=7), A072201 (n=8), ...
Columns of array: A022998(n-1)/2 (k=0), A178414 (k=1), ...
Cf. A347834 (permuted rows of the array).

Programs

  • Mathematica
    t[n_,1] := t[n,1] = If[OddQ[n],4n-3,2n-1]; t[n_,k_] := t[n,k] = 4*t[n,k-1]+1; Flatten[Table[t[n-i+1,i], {n,20}, {i,n}]]

Formula

From Bob Selcoe, Apr 09 2015 (Start):
T(n,k) = 4*T(n,k-1) + 1.
T(n,k) = T(1,k) + 2^(2k+1)*(n-1)/2 when n is odd;
T(n,k) = T(2,k) + 4^k*(n-2)/2 when n >= 2 and n is even. So equivalently:
T(n,k) = T(n-2,k) + 2^(2k+1) when n is odd; and
T(n,k) = T(n-2,k) + 4^k when n is even.
Let j be the n-th positive odd number coprime with 3. Then:
T(n,k) = (j*4^k - 1)/3 when j == 1 (mod 3); and
T(n,k) = (j*2^(2k-1) - 1)/3 when j == 2 (mod 3).
(End)
From Wolfdieter Lang, Sep 18 2021: (Start)
T(n, k) = ((3*n - 1)*4^k - 2)/6 if n is even, and ((3*n - 2)*4^k - 1)/3 if n is odd, for n >= 1 and k >= 1. Also for n = 0: -A007583(k-1), with A007583(-1) = 1/2, and for k = 0: A022998(n-1)/2, with A022998(-1) = -1.
O.g.f. for array T (with row n = 0 and column k = 0; z for rows and x for columns): G(z, x) = (1/(2*(1-x)*(1-4*x)*(1-z^2)^2)) * ((2*x-4)*z^3 + (3-5*x)*z^2 + 2*x*z + 3*x - 1). (End)

A386314 a(1) = 1 and thereafter a(n) is the smallest number k of the form 6*x+-1 not already in the sequence but where the reduced Collatz step A139391(k) is in the sequence.

Original entry on oeis.org

1, 5, 13, 17, 11, 7, 29, 19, 25, 37, 49, 53, 35, 23, 61, 65, 43, 77, 85, 101, 67, 89, 59, 113, 133, 149, 157, 173, 115, 181, 197, 131, 205, 209, 139, 185, 229, 241, 245, 163, 217, 269, 179, 119, 79, 277, 289, 301, 305, 203, 317, 211, 281, 187, 325, 341, 227, 151, 349, 373
Offset: 1

Views

Author

Jules Beauchamp, Jul 18 2025

Keywords

Comments

These numbers are the Collatz pre-images in the form 6*x +- 1 of all previous terms not already in the sequence.
The pre-images of a term t are all p which reach t by a single odd to odd step A139391(p) = t.
These pre-images are those p = (t*2^k-1)/3 with k>=0 which are odd integers, and with here t != 0 (mod 3) there are infinitely many p != 0 (mod 3) for each t.
Multiples of 3 have no odd pre-images and are excluded here in order to have the essential part of the tree of odd to odd descents.
The trajectory of a term t reaches 1 by steps to successively earlier terms in this sequence (at various distances apart).
If the Collatz conjecture is true, then this sequence is permutation of the numbers of the form 6x +- 1 (A007310).

Examples

			a(3) = 13, since 13 (a pre-image of a(2) = 5) is the smallest unused pre-image of a(1) and a(2).
a(10) = 37 since 37 (a pre-image of a(6) = 7) is the smallest unused pre-image of all previous terms.
		

Crossrefs

Programs

  • PARI
    lista(nn) = my(va=List(1), vs = Map(), imin=1, i=imin, nb=1); mapput(vs, 1, 1); while(#vaMichel Marcus, Aug 25 2025
Showing 1-3 of 3 results.