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-9 of 9 results.

A080782 a(1)=1, a(n)=a(n-1)-1 if n is already in the sequence, a(n)=a(n-1)+2 otherwise.

Original entry on oeis.org

1, 3, 2, 4, 6, 5, 7, 9, 8, 10, 12, 11, 13, 15, 14, 16, 18, 17, 19, 21, 20, 22, 24, 23, 25, 27, 26, 28, 30, 29, 31, 33, 32, 34, 36, 35, 37, 39, 38, 40, 42, 41, 43, 45, 44, 46, 48, 47, 49, 51, 50, 52, 54, 53, 55, 57, 56, 58, 60, 59, 61, 63, 62, 64, 66, 65, 67, 69, 68
Offset: 1

Views

Author

Benoit Cloitre, Mar 07 2003

Keywords

Comments

Permutation of the integers: exchange trisections starting with 2 and 3.
a(a(n)) = n. - Reinhard Zumkeller, Oct 29 2004

Crossrefs

Programs

  • Mathematica
    Array[#+Mod[#+1,3]&,70,0] (* or *) LinearRecurrence[{1,0,1,-1},{1,3,2,4},70] (* Harvey P. Dale, Mar 29 2013 *)
    {#,#+1,#-1}[[Mod[#,3,1]]]&/@Range[99] (* Federico Provvedi, May 15 2021 *)

Formula

a(n) = A064429(n-1) + 1.
a(n) - n is periodic with period 3.
G.f.: x*(1+2*x-x^2+x^3)/(1-x-x^3+x^4). - Jaume Oliver Lafont, Mar 24 2009
a(0)=1, a(1)=3, a(2)=2, a(3)=4, a(n)=a(n-1)+0*a(n-2)+a(n-3)-a(n-4). - Harvey P. Dale, Mar 29 2013
a(n) = n + (2/sqrt(3))*sin(2*(n+2)*Pi/3). - Wesley Ivan Hurt, Sep 26 2017
From Guenther Schrack, Oct 23 2019: (Start)
a(n) = a(n-3) + 3 with a(1) = 1, a(2) = 3, a(3) = 2 for n > 3.
a(n) = n - (w^(2*n)*(2 + w) + w^n*(1 - w))/3 where w = (-1 + sqrt(-3))/2. (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = 2*Pi/(3*sqrt(3)) - log(2)/3. - Amiram Eldar, Jan 31 2023
From Charles L. Hohn, Sep 03 2024: (Start)
a(n) = n-1+n%3.
a(n) = A375336(n-2, 1) for n >= 6. (End)

A074066 Zigzag modulo 3.

Original entry on oeis.org

1, 4, 3, 2, 7, 6, 5, 10, 9, 8, 13, 12, 11, 16, 15, 14, 19, 18, 17, 22, 21, 20, 25, 24, 23, 28, 27, 26, 31, 30, 29, 34, 33, 32, 37, 36, 35, 40, 39, 38, 43, 42, 41, 46, 45, 44, 49, 48, 47, 52, 51, 50, 55, 54, 53, 58, 57, 56, 61, 60, 59, 64, 63, 62, 67, 66, 65, 70, 69
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 17 2002

Keywords

Comments

Take natural numbers, exchange trisections starting with 2 and 4.

Crossrefs

Programs

  • Haskell
    a074066 n = a074066_list !! (n-1)
    a074066_list = 1 : xs where xs = 4 : 3 : 2 : map (+ 3) xs
    -- Reinhard Zumkeller, Feb 21 2011
  • Mathematica
    a[n_] := n + Mod[n, 3]*(3*Mod[n, 3] - 5); a[1] = 1; Table[a[n], {n, 1, 69}] (* Jean-François Alcover, Nov 04 2011 *)
    Join[{1},Flatten[Reverse/@Partition[Range[2,73],3]]] (* Harvey P. Dale, Feb 17 2012 *)

Formula

a(1)=1; for n>0: a(3*n-1) = 3*n+1, a(3*n) = 3*n, a(3*n+1) = 3*n-1.
a(a(n))=n (self-inverse permutation); for n>1: a(n) = n iff n == 0 modulo 3.
For n > 1: a(n) = 3*floor(n/3) + (n mod 3)^2 * (-1)^(n mod 3); a(1)=1.
a(n) = a(n-1) + a(n-3) - a(n-4) for n > 5. - Chai Wah Wu, May 25 2016
For n > 1, a(n) = n - (4/sqrt(3))*sin(2*n*Pi/3). - Wesley Ivan Hurt, Sep 29 2017
g.f.: x + x^2*(4-x-x^2+x^3) / ( (1+x+x^2)*(x-1)^2 ). - R. J. Mathar, May 22 2019
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Dec 24 2023

A092486 Take natural numbers, exchange first and third quadrisection.

Original entry on oeis.org

3, 2, 1, 4, 7, 6, 5, 8, 11, 10, 9, 12, 15, 14, 13, 16, 19, 18, 17, 20, 23, 22, 21, 24, 27, 26, 25, 28, 31, 30, 29, 32, 35, 34, 33, 36, 39, 38, 37, 40, 43, 42, 41, 44, 47, 46, 45, 48, 51, 50, 49, 52, 55, 54, 53, 56, 59, 58, 57, 60, 63, 62, 61, 64, 67, 66, 65, 68, 71, 70, 69, 72
Offset: 0

Views

Author

Ralf Stephan, Apr 04 2004

Keywords

Crossrefs

Programs

  • Mathematica
    Flatten[Partition[Range[80],4]/.{a_,b_,c_,d_}->{c,b,a,d}] (* Harvey P. Dale, Aug 12 2012 *)
  • PARI
    { f="b092486.txt"; for (n=0, 5000, a0=4*n + 3; a1=a0 - 1; a2=a1 - 1; a3=a0 + 1; write(f, 4*n, " ", a0); write(f, 4*n+1, " ", a1); write(f, 4*n+2, " ", a2); write(f, 4*n+3, " ", a3); ); } \\ Harry J. Smith, Jun 21 2009

Formula

G.f.: (3-4*x+3*x^2)/((1+x^2)*(1-x)^2).
a(4n) = 4n+3, a(4n+1) = 4n+2, a(4n+2) = 4n+1, a(4n+3) = 4n+4.
a(n) = n+1+i^n+(-i)^n, where i is the imaginary unit. - Bruno Berselli, Feb 08 2011
From Wesley Ivan Hurt, May 09 2021: (Start)
a(n) = 2*a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4).
a(n) = 1 + n + 2*cos(n*Pi/2). (End)
Sum_{n>=0} (-1)^n/a(n) = log(2) (A002162). - Amiram Eldar, Nov 28 2023

A330396 Permutation of the nonnegative integers partitioned into triples [3*k+2, 3*k+1, 3*k] for k >= 0.

Original entry on oeis.org

2, 1, 0, 5, 4, 3, 8, 7, 6, 11, 10, 9, 14, 13, 12, 17, 16, 15, 20, 19, 18, 23, 22, 21, 26, 25, 24, 29, 28, 27, 32, 31, 30, 35, 34, 33, 38, 37, 36, 41, 40, 39, 44, 43, 42, 47, 46, 45, 50, 49, 48, 53, 52, 51, 56, 55, 54, 59, 58, 57, 62, 61, 60, 65, 64, 63, 68, 67, 66, 71, 70, 69, 74, 73, 72, 77, 76, 75, 80, 79, 78, 83, 82
Offset: 0

Views

Author

Guenther Schrack, Mar 03 2020

Keywords

Comments

Partition the nonnegative integer sequence into triples starting with (0,1,2); transpose the first and third elements of the triple, repeat for all triples.
A self-inverse sequence: a(a(n)) = n.
The sequence is an interleaving of A016789 with A016777 and with A008585, in that order.

Crossrefs

Fixed point sequence: A016777.
Relationships:
a(n) = a(n-1) - 1 + 6*A079978(n).
a(n) = 2*a(n-1) - a(n-2) + 6*A049347(n).
a(n) = A074066(n+2) - 2.
a(n) = A113655(n+1) - 1.

Programs

  • MATLAB
    a = zeros(1,10000);
    w = (-1+sqrt(-3))/2;
    fprintf('0 2\n');
    for n = 1:10000
       a(n) = int64((3*n + 2*w^(2*n)*(w + 2) + 2*w^n*(1 - w))/3);
       fprintf('%i %i\n',n,a(n));
    end

Formula

G.f.: (2 - x - x^2 + 3*x^3)/((x-1)^2*(1 + x + x^2)). [corrected by Georg Fischer, Apr 17 2020]
Linear recurrence: a(n) = a(n-1) + a(n-3) - a(n-4) for n > 4.
Simple recursion: a(n) = a(n-3) + 3 for n > 2 with a(0) = 2, a(1) = 1, a(2) = 0.
Negative domain: a(-n) = -(a(n-1) + 1).
Explicit formulas:
a(n) = n + 2 - 2*(n mod 3).
a(n) = 2 - n + 6*floor(n/3).
a(n) = n + 2*(w^(2*n)*(2 + w) + w^n*(1 - w))/3 where w = (-1 + sqrt(-3))/2.

A080413 Take the rightmost three binary digits of n (for n<4 padded with leading zeros) and rotate left 1 digit.

Original entry on oeis.org

0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15, 16, 18, 20, 22, 17, 19, 21, 23, 24, 26, 28, 30, 25, 27, 29, 31, 32, 34, 36, 38, 33, 35, 37, 39, 40, 42, 44, 46, 41, 43, 45, 47, 48, 50, 52, 54, 49, 51, 53, 55, 56, 58, 60, 62, 57, 59, 61, 63, 64, 66, 68, 70, 65, 67, 69, 71, 72
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 17 2003

Keywords

Examples

			a(2)=a('010')='100'=4; a(3)=a('011')='110'=6; a(4)=a('100')='001'=1; a(5)=a('101')='011'=3;
a(20)=a('10'100')='10'001'=17; a(21)=a('10'101')='10'011'=19.
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 1, -1}, {0, 2, 4, 6, 1, 3, 5, 7, 8}, 73] (* Georg Fischer, Jul 03 2025 *)
  • Python
    def A080413(n): return ((n&3)<<1)+bool(n&4)+(n&-8) # Chai Wah Wu, Jan 21 2023

Formula

For n>7: a(n) = 8*floor(n/8) + a(n mod 8).
A permutation of natural numbers with inverse = A080414: A080414(a(n))=n, a(A080414(n))=n.
a(a(n))=A080414(n), A080414(A080414(n))=a(n), a(a(a(n)))=n.

A080414 Take the rightmost three binary digits of n (for n<4 padded with leading zeros) and rotate right 1 digit.

Original entry on oeis.org

0, 4, 1, 5, 2, 6, 3, 7, 8, 12, 9, 13, 10, 14, 11, 15, 16, 20, 17, 21, 18, 22, 19, 23, 24, 28, 25, 29, 26, 30, 27, 31, 32, 36, 33, 37, 34, 38, 35, 39, 40, 44, 41, 45, 42, 46, 43, 47, 48, 52, 49, 53, 50, 54, 51, 55, 56, 60, 57, 61, 58, 62, 59, 63, 64, 68, 65, 69, 66, 70, 67, 71, 72
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 17 2003

Keywords

Examples

			a(2)=a('010')='001'=1; a(3)=a('011')='101'=5; a(4)=a('100')='010'=2; a(5)=a('101')='110'=6;
a(20)=a('10'100')='10'010'=18; a(21)=a('10'101')='10'110'=22.
		

Crossrefs

Programs

  • Mathematica
    r3bd[n_]:=Module[{a,b},{a,b}=Reverse[TakeDrop[IntegerDigits[n,2],-3]];FromDigits[Join[a,RotateRight[b]],2]]; Join[{0,4,1,5},Table[r3bd[n],{n,4,80}]] (* Harvey P. Dale, Jul 30 2021 *)
    LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 1, -1}, {0, 4, 1, 5, 2, 6, 3, 7, 8}, 73] (* Georg Fischer, Jul 03 2025 *)
  • Python
    def A080414(n): return ((n&6)>>1)+((n&1)<<2)+(n&-8) # Chai Wah Wu, Jan 21 2023

Formula

For n>7: a(n) = 8*floor(n/8) + a(n mod 8).
A permutation of natural numbers with inverse A080413: A080413(a(n))=n, a(A080413(n))=n.
a(a(n))=A080413(n), A080413(A080413(n))=a(n), a(a(a(n)))=n.

A159253 a(n) is the smallest positive integer not yet in the sequence such that n * a(n) is a cube.

Original entry on oeis.org

1, 4, 9, 2, 25, 36, 49, 8, 3, 100, 121, 18, 169, 196, 225, 32, 289, 12, 361, 50, 441, 484, 529, 72, 5, 676, 27, 98, 841, 900, 961, 16, 1089, 1156, 1225, 6, 1369, 1444, 1521, 200, 1681, 1764, 1849, 242, 75, 2116, 2209, 288, 7, 20, 2601, 338, 2809, 108, 3025, 392
Offset: 1

Views

Author

Keywords

Comments

This is a self-inverse permutation of the positive integers.

Crossrefs

Cf. A064429 (function on exponents)

Programs

  • Mathematica
    f[p_, e_] := If[(r = Mod[e, 3]) == 0, p^e, p^(e - (-1)^r)]; a[n_] := Times @@ (f @@@ FactorInteger[n]); Array[a, 100] (* Amiram Eldar, Aug 29 2019 *)
  • PARI
    a(n) = {my(f = factor(n), r); prod(i = 1, #f~, r=f[i,2]%3; f[i,1]^if(r == 0, f[i,2], f[i,2]-(-1)^r));} \\ Amiram Eldar, Dec 01 2022

Formula

Multiplicative with a(p^(3*n)) = p^(3*n), a(p^(3*n+1)) = p^(3*n+2), and a(p^(3*n+2)) = p^(3*n+1).
Sum_{k=1..n} a(k) ~ c * n^3, where c = (zeta(6)/(3*zeta(3))) * Product_{p prime} (1 - 1/p^2 + 1/p^3) = A347328 * A330596 / 3 = 0.2111705... . - Amiram Eldar, Dec 01 2022

A076505 3 people at a party are saying Hello to each other. Person 1 says Hello. Person 2 counts the times Hello has been said and says Hello twice that number. Person 3 says Hello 3 times the sum of Hello's and then it is Person 1 again. This is how many Hello's each person says.

Original entry on oeis.org

1, 2, 9, 12, 48, 216, 288, 1152, 5184, 6912, 27648, 124416, 165888, 663552, 2985984, 3981312, 15925248, 71663616, 95551488, 382205952, 1719926784, 2293235712, 9172942848, 41278242816, 55037657088, 220150628352, 990677827584
Offset: 1

Views

Author

Jon Perry, Oct 15 2002

Keywords

Crossrefs

Cf. A076506.

Programs

  • Mathematica
    LinearRecurrence[{0, 0, 24}, {1, 2, 9, 12}, 30] (* Paolo Xausa, Apr 22 2024 *)
  • PARI
    mod 3(n)=if (i%3==0,3,i%3) s=1; for (i=2,30,print1(s*mod 3(i),","); s=s+s*mod 3(i))

Formula

For n>4, a(n) = a(n-3)*4!. - Rob Hoogers (chimera(AT)chimera.fol.nl), Jun 27 2004
a(n) = 2^i*3^j, with i=A064429(n-1), j=[n/3]+[n%3==0].
G.f.: x*(1-x)*(1+3*x+12*x^2)/(1-24*x^3). - Colin Barker, Jun 07 2012

Extensions

More terms from Rob Hoogers (chimera(AT)chimera.fol.nl), Jun 27 2004
An incorrect comment was deleted, Aug 02 2010

A317613 Permutation of the nonnegative integers: lodumo_4 of A047247.

Original entry on oeis.org

2, 3, 0, 1, 4, 5, 6, 7, 10, 11, 8, 9, 12, 13, 14, 15, 18, 19, 16, 17, 20, 21, 22, 23, 26, 27, 24, 25, 28, 29, 30, 31, 34, 35, 32, 33, 36, 37, 38, 39, 42, 43, 40, 41, 44, 45, 46, 47, 50, 51, 48, 49, 52, 53, 54, 55, 58, 59, 56, 57, 60, 61, 62, 63, 66, 67, 64
Offset: 0

Views

Author

Keywords

Comments

Write n in base 8, then apply the following substitution to the rightmost digit: '0'->'2, '1'->'3', and vice versa. Convert back to decimal.
A self-inverse permutation: a(a(n)) = n.
Array whose columns are, in this order, A047463, A047621, A047451 and A047522, read by rows.

Examples

			a(25) = a('3'1') = '3'3' = 27.
a(26) = a('3'2') = '3'0' = 24.
a(27) = a('3'3') = '3'1' = 25.
a(28) = a('3'4') = '3'4' = 28.
a(29) = a('3'5') = '3'5' = 29.
The sequence as array read by rows:
  A047463, A047621, A047451, A047522;
        2,       3,       0,       1;
        4,       5,       6,       7;
       10,      11,       8,       9;
       12,      13,      14,      15;
       18,      19,      16,      17;
       20,      21,      22,      23;
       26,      27,      24,      25;
       28,      29,      30,      31;
  ...
		

Crossrefs

Programs

  • Magma
    m:=100; R:=PowerSeriesRing(Integers(), m); Coefficients(R!((x^7+x^5+3*x^3-2*x^2-x+2)/((1-x)^2*(x^6+x^4+ x^2+1)))); // G. C. Greubel, Sep 25 2018
  • Mathematica
    Table[(4*(Floor[1/4 Mod[2*n + 4, 8]] - Floor[1/4 Mod[n + 2, 8]]) + 2*n)/2, {n, 0, 100}]
    f[n_] := Block[{id = IntegerDigits[n, 8]}, FromDigits[ Join[Most@ id /. {{} -> {0}}, {id[[-1]] /. {0 -> 2, 1 -> 3, 2 -> 0, 3 -> 1}}], 8]]; Array[f, 67, 0] (* or *)
    CoefficientList[ Series[(x^7 + x^5 + 3x^3 - 2x^2 - x + 2)/((x - 1)^2 (x^6 + x^4 + x^2 + 1)), {x, 0, 70}], x] (* or *)
    LinearRecurrence[{2, -2, 2, -2, 2, -2, 2, -1}, {2, 3, 0, 1, 4, 5, 6, 7}, 70] (* Robert G. Wilson v, Aug 01 2018 *)
  • Maxima
    makelist((4*(floor(mod(2*n + 4, 8)/4) - floor(mod(n + 2, 8)/4)) + 2*n)/2, n, 0, 100);
    
  • PARI
    my(x='x+O('x^100)); Vec((x^7+x^5+3*x^3-2*x^2-x+2)/((1-x)^2*(x^6+x^4+ x^2+1))) \\ G. C. Greubel, Sep 25 2018
    

Formula

a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - 2*a(n-4) + 2*a(n-5) - 2*a(n-6) + 2*a(n-7) - a(n-8), n > 7.
a(n) = (4*(floor(((2*n + 4) mod 8)/4) - floor(((n + 2) mod 8)/4)) + 2*n)/2.
a(n) = lod_4(A047247(n+1)).
a(4*n) = A047463(n+1).
a(4*n+1) = A047621(n+1).
a(4*n+2) = A047451(n+1).
a(4*n+3) = A047522(n+1).
a(A042948(n)) = A047596(n+1).
a(A042964(n+1)) = A047551(n+1).
G.f.: (x^7 + x^5 + 3*x^3 - 2*x^2 - x + 2)/((x-1)^2 * (x^2+1) * (x^4+1)).
E.g.f.: x*exp(x) + cos(x) + sin(x) + cos(x/sqrt(2))*cosh(x/sqrt(2)) + (sqrt(2)*cos(x/sqrt(2)) - sin(x/sqrt(2)))*sinh(x/sqrt(2)).
a(n+8) = a(n) + 8 . - Philippe Deléham, Mar 09 2023
Sum_{n>=3} (-1)^(n+1)/a(n) = 1/6 + log(2). - Amiram Eldar, Mar 12 2023
Showing 1-9 of 9 results.