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-6 of 6 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

A109718 Periodic sequence with period {0,1,0,3}, or n^3 mod 4.

Original entry on oeis.org

0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0
Offset: 0

Views

Author

Bruce Corrigan (scentman(AT)myfamily.com), Aug 09 2005

Keywords

Comments

Since n^(2k+1) mod 4 = n^3 mod 4 for k>1 this sequence also represents n^5 mod 4; and n^7 mod 4; etc.

Crossrefs

n mod 4 = A010873; n^2 mod 4 = A000035.
Cf. A110270; A131743. - Bruno Berselli, Mar 14 2011

Programs

Formula

a(n) = n^3 mod 4.
G.f. = (x+3*x^3)/(1-x^4).
a(n) = (n mod 2)*(n mod 4) = (1+(-1)^(n+1))*(2+i^(n+1))/2 with i=sqrt(-1). - Bruno Berselli, Mar 14 2011

A189998 Numerator of h(n+5) - h(n) where h(n) = Sum_{k=1..n} (1/k) are the Harmonic numbers.

Original entry on oeis.org

137, 29, 153, 743, 1879, 1627, 15797, 2021, 11899, 25381, 7793, 2627, 124877, 26987, 68879, 65003, 107699, 66167, 482897, 16167, 77293, 412561, 323959, 94781, 1323137, 255127, 587299, 504563, 255733, 145209, 2956637, 277681, 1247459, 2094661, 1558379, 433501
Offset: 0

Views

Author

Gary Detlefs, May 03 2011

Keywords

Comments

a(n) = Numerator of (5*n^4 + 60*n^3 + 255*n^2 + 450*n + 274)/((n+1)*(n+2)*(n+3)*(n+4)*(n+5)).
(5*n^4 + 60*n^3 + 255*n^2 + 450*n + 274)/a(n) can be factored into 2^p(n)* 3^q(n) where p(n) is a sequence of period 4 repeating [1,2,1,3] and q(n) is of period 9,repeating [0,2,2,0,1,1,0,1,1].
p(n) = A131743(n) + 1.
q(n) = A011655(n) + [0,2,2,0,0,0,0,0,0]

Crossrefs

Programs

  • Magma
    [137] cat [Numerator(HarmonicNumber(n+5)-HarmonicNumber(n)): n in [0..30]]; // G. C. Greubel, Jan 11 2018
    
  • Maple
    h:= n->sum(1/k,k=1..n):seq(numer(h(n+5)-h(n)), n=0..28);
    q:=n-> (1-(-1)^n)*(3+I^(n+1))/4+1:
    P:=(k,n)-> floor(1/2*cos(2*n*Pi/k)+1/2):
    seq( (5*n^4+60*n^3+255*n^2+450*n+274)/(2^q(n)*3^(P(9,n-1)+P(9,n-2)+1-P(3,n))),n=0..28)
  • Mathematica
    Numerator[Table[HarmonicNumber[n+5]-HarmonicNumber[n],{n,0,30}]] (* Harvey P. Dale, Sep 15 2016 *)
  • Python
    from sympy import harmonic,numer
    print([numer(harmonic(n+5) - harmonic(n)) for n in range(0, 30)])
    # Javier Rivera Romeu, May 22 2023

Formula

a(n) = (5*n^4 + 60*n^3 + 255*n^2 + 450*n + 274)/(2^q(n)*3^(P(9,n-1) + P(9,n-2) + 1 - P(3,n))), where q(n) = (1-(-1)^n)*(3+i^(n+1))/4 + 1 and P(k,n) = floor(1/2*cos(2*n*Pi/k)+1/2).

A364447 Repeat [1,2,1,3].

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1
Offset: 1

Views

Author

Rok Cestnik, Jul 25 2023

Keywords

Comments

Continued fraction of sqrt(5) - 3/2 = 0.7360679... (without integer part); and (4*sqrt(5) + 6)/11 = 1.3585701... (with integer part).
Lexicographically earliest sequence in which n is banned for n terms after each appearance (see A364448 for n^2 and A364449 for n^3).

Crossrefs

Cf. A131743 (repeat [0,1,0,2]).

Programs

  • Mathematica
    PadRight[{}, 100, {1, 2, 1, 3}] (* Paolo Xausa, Jan 23 2025 *)
  • Python
    def A364447(n): return (3,1,2,1)[n&3] # Chai Wah Wu, Jul 29 2023

Formula

a(n) = A131743(n-1) + 1.

A180713 If n is even then a(n) = 3n, if n == 1 mod 4 then a(n) = 3n+1, if n == 3 mod 4 then a(n) = 3n+2.

Original entry on oeis.org

0, 4, 6, 11, 12, 16, 18, 23, 24, 28, 30, 35, 36, 40, 42, 47, 48, 52, 54, 59, 60, 64, 66, 71, 72, 76, 78, 83, 84, 88, 90, 95, 96, 100, 102, 107, 108, 112, 114, 119, 120, 124, 126, 131, 132, 136, 138, 143, 144, 148, 150, 155, 156, 160, 162, 167, 168, 172, 174, 179, 180, 184, 186, 191, 192, 196, 198, 203, 204
Offset: 0

Views

Author

N. J. A. Sloane, Jan 21 2011

Keywords

Crossrefs

A variant of A006368.

Programs

  • Maple
    U:=n->if n mod 2 = 0 then 3*n elif n mod 4 = 1 then 3*n+1 else 3*n+2; fi;
  • Mathematica
    fn[n_]:=Which[EvenQ[n],3n,Mod[n,4]==1,3n+1,Mod[n,4]==3,3n+2]; Array[fn,70,0] (* Harvey P. Dale, May 03 2013 *)
    CoefficientList[Series[x (4 + 2 x + 5 x^2 + x^3) / ((1 - x) (1 - x^4)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 19 2013 *)

Formula

From Bruno Berselli, Jan 23 2011: (Start)
G.f.: x*(4+2*x+5*x^2+x^3)/((1-x)*(1-x^4)).
a(n) = (12*n+i*(i^n-(-i)^n)-3*(-1)^n+3)/4, where i is the imaginary unit.
a(n) = A131743(n) + 3*n. (End)
a(n) = +1*a(n-1)+1*a(n-4)-1*a(n-5) for n>=5. [Joerg Arndt, Jan 25 2011]

Extensions

Definition corrected by N. J. A. Sloane, Jan 23 2011

A281098 a(n) is the GCD of the sequence d(n) = A261327(k+n) - A261327(k) for all k.

Original entry on oeis.org

0, 1, 1, 3, 4, 1, 3, 1, 8, 3, 5, 1, 12, 1, 7, 3, 16, 1, 9, 1, 20, 3, 11, 1, 24, 1, 13, 3, 28, 1, 15, 1, 32, 3, 17, 1, 36, 1, 19, 3, 40, 1, 21, 1, 44, 3, 23, 1, 48, 1, 25, 3, 52, 1, 27, 1, 56, 3, 29, 1, 60, 1, 31, 3, 64, 1, 33, 1, 68, 3, 35, 1, 72, 1, 37, 3, 76, 1, 39, 1
Offset: 0

Views

Author

Paul Curtz, Jan 14 2017

Keywords

Comments

Successive sequences:
0: 0, 0, 0, 0, ... = 0 * ( )
1: 4, -3, 11, -8, ... = 1 * ( )
2: 1, 8, 3, 16, ... = 1 * ( ) A195161
3: 12, 0, 27, -3, ... = 3 * (4, 0, 9, -1, ...)
4: 4, 24, 8, 40, ... = 4 * (1, 6, 2, 10, ...) A064680
5; 28, 5, 51, 4, ... = 1 * ( )
6: 9, 48, 15, 72, ... = 3 * (3, 16, 5, 24, ...) A195161
7: 52, 12, 83, 13, ... = 1 * ( )
8: 16, 80, 24, 112, ... = 8 * (2, 10, 3, 14, ...) A064080
9: 84 21, 123, 24, ... = 3 * (28, 7, 41, 8, ...)
10: 25, 120, 35, 160, ... = 5 * (5, 24, 7, 32, ...) A195161

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[(-x (-1 - x - 4 x^2 - 5 x^3 - 3 x^4 - 6 x^5 + 3 x^6 - 5 x^7 + 4 x^8 - x^9 + x^10))/((x^2 - x + 1) (1 + x + x^2) (x - 1)^2*(1 + x)^2*(1 + x^2)^2), {x, 0, 79}], x] (* Michael De Vlieger, Feb 02 2017 *)
  • PARI
    f(n) = numerator((4 + n^2)/4);
    a(n) = gcd(vector(1000, k, f(k+n) - f(k))); \\ Michel Marcus, Jan 15 2017
    
  • PARI
    A281098(n) = if(n%2, gcd((n\2)-1,3), n>>(bitand(n,2)/2)); \\ Antti Karttunen, Feb 15 2023

Formula

G.f.: -x*( -1 - x - 4*x^2 - 5*x^3 - 3*x^4 - 6*x^5 + 3*x^6 - 5*x^7 + 4*x^8 - x^9 + x^10 )/( (x^2 - x + 1)*(1 + x + x^2)*(x - 1)^2*(1 + x)^2*(1 + x^2)^2 ). - R. J. Mathar, Jan 31 2017
a(2*k) = A022998(k).
a(2*k+1) = A109007(k-1).
a(3*k) = interleave 3*k*(3 +(-1)^k)/2, 3.
a(3*k+1) = interleave 1, A166304(k).
a(3*k+2) = interleave A166138(k), 1.
a(4*k) = 4*k.
a(4*k+1) = period 3: repeat [1, 1, 3].
a(4*k+2) = 1 + 2*k.
a(4*k+3) = period 3: repeat [3, 1, 1].
a(n+12) - a(n) = 6*A131743(n+3).
a(n) = (18*n + 40 - 16*cos(n*Pi/3) + 9*n*cos(n*Pi/2) + 32*cos(2*n*Pi/3) + (18*n - 40)*cos(n*Pi) + 3*n*cos(3*n*Pi/2) - 16*cos(5*n*Pi/3))/48. - Wesley Ivan Hurt, Oct 04 2018

Extensions

Corrected and extended by Michel Marcus, Jan 15 2017
Showing 1-6 of 6 results.