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.

Previous Showing 11-20 of 32 results. Next

A339443 Pairwise listing of the partitions of k into two parts (s,t), with 0 < t <= s ordered by decreasing values of s and where k = 2,3,... .

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 2, 2, 4, 1, 3, 2, 5, 1, 4, 2, 3, 3, 6, 1, 5, 2, 4, 3, 7, 1, 6, 2, 5, 3, 4, 4, 8, 1, 7, 2, 6, 3, 5, 4, 9, 1, 8, 2, 7, 3, 6, 4, 5, 5, 10, 1, 9, 2, 8, 3, 7, 4, 6, 5, 11, 1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 6, 12, 1, 11, 2, 10, 3, 9, 4, 8, 5, 7, 6, 13, 1, 12, 2, 11
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 05 2020

Keywords

Examples

			                                                                     [9,1]
                                                     [7,1]   [8,1]   [8,2]
                                     [5,1]   [6,1]   [6,2]   [7,2]   [7,3]
                     [3,1]   [4,1]   [4,2]   [5,2]   [5,3]   [6,3]   [6,4]
     [1,1]   [2,1]   [2,2]   [3,2]   [3,3]   [4,3]   [4,4]   [5,4]   [5,5]
   k   2       3       4       5       6       7       8       9      10
  --------------------------------------------------------------------------
   k   Nonincreasing partitions of k
  --------------------------------------------------------------------------
   2   1,1
   3   2,1
   4   3,1,2,2
   5   4,1,3,2
   6   5,1,4,2,3,3
   7   6,1,5,2,4,3
   8   7,1,6,2,5,3,4,4
   9   8,1,7,2,6,3,5,4
  10   9,1,8,2,7,3,6,4,5,5
  ...
		

Crossrefs

Bisections: A199474, A122197.

Programs

  • Mathematica
    Table[(1 - (-1)^n) (1 + Floor[Sqrt[2 n - 1]])/2 - (((-1)^n - 2 n - 1)/2 + 2 Sum[Floor[(k + 1)/2], {k, -1 + Floor[Sqrt[2 n - 2 - (-1)^n]]}]) (-1)^n/2, {n, 100}]

Formula

a(n) = (1-(-1)^n)*(1+floor(sqrt(2*n-1)))/2-(((-1)^n-2*n-1)/2 + 2*Sum_{k=1..-1+floor(sqrt(2*n-2-(-1)^n))} floor((k+1)/2))*(-1)^n/2.
a(n) = A339399(A103889(n)). - Wesley Ivan Hurt, May 09 2021

A011262 In the prime factorization of n, increment odd powers and decrement even powers (multiplicative and self-inverse).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a011262 n = product $ zipWith (^)
                          (a027748_row n) (map a103889 $ a124010_row n)
    -- Reinhard Zumkeller, Jun 23 2013
  • Mathematica
    f[n_, k_] := n^(If[EvenQ[k], k - 1, k + 1]); Table[Times @@ f @@@ FactorInteger[n], {n, 57}] (* Jayanta Basu, Aug 14 2013 *)
  • PARI
    a(n)=my(f=factor(n));return(prod(i=1,#f[,1],f[i,1]^(f[i,2]-(-1)^f[i,2]))) \\ Paul Tek, Jun 01 2013
    

Formula

Multiplicative with f(p^k) = p^(k-1) if k even, p^(k+1) if k odd.
a(n) = Product_{k = 1..A001221(n)} A027748(n,k) ^ A103889(A124010(n,k)). - Reinhard Zumkeller, Jun 23 2013
Sum_{k=1..n} a(k) ~ c * n^3, where c = (1/3) * Product_{p prime} ((p^5 + p^4 - p + 1)/(p^5 + p^4 + p^3 + p^2)) = 0.21311151701724196530... . - Amiram Eldar, Oct 13 2022

A056699 First differences are 2,1,-2,3 (repeated).

Original entry on oeis.org

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

Views

Author

Michael Knauth (knauth_jur(AT)yahoo.de), Nov 21 2003

Keywords

Comments

Second quadrisection of natural numbers shifted right two places. - Ralf Stephan, Jun 10 2005
A permutation of the natural numbers partitioned into quadruples [4k-3,4k-1,4k,4k-2] for k > 0. Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the second and third elements, then swap the third and fourth elements; repeat for all quadruples. - Guenther Schrack, Oct 18 2017

Crossrefs

Inverse: A284307.
Sequence of fixed points: A016813(n-1) for n > 0.
Odd elements: A005408(n-1) for n > 0.
Indices of odd elements: A042963(n) for n > 0.
Even elements: 2*A103889(n) for n > 0.
Indices of even elements: A014601(n) for n > 0.

Programs

  • MATLAB
    a = [1 3 4 2];
    max = 10000;  % Generation of a b-file
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    % Guenther Schrack, Oct 18 2017
    
  • Magma
    [Floor((n - ((-1)^n + (-1)^(n*(n-1)/2)*(2+(-1)^n)) / 2)): n in [1..100]]; // Vincenzo Librandi, Feb 05 2018
  • Mathematica
    LinearRecurrence[{1,0,0,1,-1},{1,3,4,2,5},70] (* Harvey P. Dale, May 10 2014 *)
    Table[Floor[(n - ((-1)^n + (-1)^(n (n - 1) / 2) (2 + (-1)^n)) / 2)], {n, 100}] (* Vincenzo Librandi, Feb 05 2018 *)
  • PARI
    for(n=1, 10000, print1(n - ((-1)^n + (-1)^(n*(n-1)/2)*(2+(-1)^n))/2, ", ")) \\ Guenther Schrack, Oct 18 2017
    

Formula

G.f.: x*(2*x^4 - 2*x^3 + x^2 + 2*x + 1)/((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Nov 08 2012
From Guenther Schrack, Oct 18 2017: (Start)
a(n) = a(n-4) + 4 for n > 4.
a(n) = n + periodic[0,1,1,-2].
a(n) = A092486(A067060(n) - 1) for n > 0.
a(n) = A292576(n) - 2*((-1)^floor(n/2)) for n > 0.
a(A116966(n-1)) = A263449(n-1) for n > 0.
A263449(a(n) - 1) = A116966(n-1) for n > 0.
a(n+2) - a(n) = (-1)^floor(n^2/4)*A132400(n+1) for n > 0.
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5. (End)
a(n) = A298364(n-1) + 1 for n > 1. - Guenther Schrack, Feb 04 2018

A280172 Lexicographically earliest table of positive integers read by antidiagonals such that no row or column contains a repeated term.

Original entry on oeis.org

1, 2, 2, 3, 1, 3, 4, 4, 4, 4, 5, 3, 1, 3, 5, 6, 6, 2, 2, 6, 6, 7, 5, 7, 1, 7, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 7, 5, 7, 1, 7, 5, 7, 9, 10, 10, 6, 6, 2, 2, 6, 6, 10, 10, 11, 9, 11, 5, 3, 1, 3, 5, 11, 9, 11, 12, 12, 12, 12, 4, 4, 4, 4, 12, 12, 12, 12, 13, 11, 9, 11, 13, 3, 1, 3, 13, 11, 9, 11, 13
Offset: 1

Views

Author

Peter Kagey, Dec 27 2016

Keywords

Comments

The table is symmetrical about the main diagonal.
The first row/column is A000027.
The second row/column is A103889.
The third row/column is A256008.
The fourth row/column is A113778.
Conjecture: The (2^k)-th antidiagonal consists entirely of 2^k.
Similar in spirit to A269526, A274528. - N. J. A. Sloane, Dec 27 2016
From Daniel Forgues, Sep 14 2019: (Start)
Plot of a(n) looks like a transform of a Sierpinski equilateral triangle.
Considering t(a(n)) = a(n)*(a(n)+1)/2: top edge of plot would be linear, but left & right sides of [concave curved] triangles would grow/decrease quadratically. a(n), a univalued sequence, tries to plot a Sierpinski triangle, which requires a multivalued sequence: a(n) uses t(2^k) terms to draw a Sierpinski triangle of width & height 2^k.
Conjecture: T(2n, k) = 2 * T(n, ceiling(k/2)), n >= 1, 1 <= k <= 2n. E.g.
row 5: 5, 3, 1, 3, 5
row 10: 10, 10, 6, 6, 2, 2, 6, 6, 10, 10 (End)
From Daniel Forgues, Sep 15 2019: (Start)
Conjectured algorithm for equilateral triangle (1-indexed rows and row terms), whose concatenated rows give this sequence: T(1, 1) = 1;
For each k >= 0, the height of the Sierpinski triangle is doubled:
* Left and right triangles: for 1 <= i <= 2^k, 1 <= j <= i:
T(2^k + i, j) = T(2^k + i, 2^k + i + 1 - j) = T(i, j) + 2^k;
* Central triangle: for 1 <= i <= 2^k - 1, 1 <= j <= i:
T(2^(k+1) - i, 2^k - i + j) = T(i, j).
Left and right triangles copies rows 1 to 2^k, terms augmented by 2^k.
Central triangle is mirrored through row 2^k.
When n is t(2^k), k >= 0, i.e., a triangular number with index a power of 2, a phase of the Sierpinski triangle plot is neatly completed. (End)

Examples

			As table (upper anti-triangular matrix) (concat. antidiagonals):
  1 2 3 4 5 6 7 8
  2 1 4 3 6 5 8
  3 4 1 2 7 8
  4 3 2 1 8
  5 6 7 8
  6 5 8
  7 8
  8
As equilateral triangle (concat. rows): (see formula section)
         1
        2 2
       3 1 3
      4 4 4 4
     5 3 1 3 5
    6 6 2 2 6 6
   7 5 7 1 7 5 7
  8 8 8 8 8 8 8 8
Lexicographically earliest equilateral triangle of positive integers read by rows such that no diagonal or antidiagonal contains a repeated term.
		

Crossrefs

Rows (or columns) 1 to 4: A000027, A103889, A256008, A113778.

Programs

Formula

T(n, k) = ( (n-1) XOR (k-1) ) + 1 = A003987(n-1, k-1) + 1. - Rémy Sigrist, Sep 18 2019
a(n) = T(row, n - t(row - 1)), n >= 1, where row = ceiling((-1 + sqrt(1 + 8*n))/2) and t(i) = i*(i+1)/2. - Daniel Forgues, Sep 20 2019

A284307 Permutation of the natural numbers partitioned into quadruples [4k-3, 4k, 4k-2, 4k-1], k > 0.

Original entry on oeis.org

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

Views

Author

Guenther Schrack, Mar 24 2017

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1, 2, 3, 4); swap the third and fourth element, then swap the second and third element; repeat for all quadruples.

Crossrefs

Inverse: A056699.
Subsequences:
elements with odd index: A042963(n), n > 0
elements with even index: A014601(A103889(n)), n > 0
odd elements: A005408(n-1), n > 0
indices of odd elements: A042948(n), n > 0
even elements: 2*A103889(n), n > 0
indices of even elements: A042964(n), n > 0
Sequence of fixed points: A016813(n-1), n > 0
Every fourth element starting at:
n=1: a(4n-3) = 4n-3 = A016813(n-1), n > 0
n=2: a(4n-2) = 4n = A008586(n), n > 0
n=3: a(4n-1) = 4n-2 = A016825(n-1), n > 0
n=4: a(4n) = 4n-1 = A004767(n-1), n > 0
Difference between pairs of elements:
a(2n+1)-a(2n-1) = A010684(n-1), n > 0
Compositions:
a(n) = A133256(A116966(n-1)), n > 0
a(A042948(n)) = A005408(n-1), n > 0
A067060(a(n)) = A092486(n), n > 0

Programs

  • MATLAB
    a = [1 4 2 3];
    max = (specify);
    for n = 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Table[n + ((-1)^n - (-1)^(n (n - 1)/2) (1 + 2 (-1)^n))/2, {n, 68}] (* Michael De Vlieger, Mar 28 2017 *)
    LinearRecurrence[{1,0,0,1,-1},{1,4,2,3,5},70] (* or *) {#[[1]],#[[4]], #[[2]],#[[3]]}&/@Partition[Range[70],4]//Flatten(* Harvey P. Dale, Sep 27 2017 *)
  • PARI
    for(n=1, 68, print1(n + ((-1)^n - (-1)^(n*(n - 1)/2)*(1 + 2*(-1)^n))/2,", ")) \\ Indranil Ghosh, Mar 29 2017

Formula

a(1)=1, a(2)=4, a(3)=2, a(4)=3, a(n) = a(n-4) + 4, n > 4.
O.g.f.: (x^4 + x^3 - 2*x^2 + 3x - 1)/(x^5 - x^4 - x + 1).
a(n) = n + ((-1)^n - (-1)^(n*(n-1)/2)*(1 + 2*(-1)^n))/2.
a(n) = n + (-1)^n*(1 - (-1)^(n*(n-1)/2) - (i^n - (-i)^n))/2.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5), n > 5.
First differences, periodic: (3, -2, 1, 2), repeat.
a(n) = (2*n - 3*cos(n*Pi/2) + cos(n*Pi) + sin(n*Pi/2))/2. - Wesley Ivan Hurt, Apr 01 2017

A086970 Fix 1, then exchange the subsequent odd numbers in pairs.

Original entry on oeis.org

1, 5, 3, 9, 7, 13, 11, 17, 15, 21, 19, 25, 23, 29, 27, 33, 31, 37, 35, 41, 39, 45, 43, 49, 47, 53, 51, 57, 55, 61, 59, 65, 63, 69, 67, 73, 71, 77, 75, 81, 79, 85, 83, 89, 87, 93, 91, 97, 95, 101, 99, 105, 103, 109, 107, 113, 111, 117, 115, 121, 119
Offset: 0

Views

Author

Paul Barry, Jul 26 2003

Keywords

Comments

Partial sums are A086955.

Crossrefs

Programs

  • Magma
    [1] cat [2*n+1-2*(-1)^n: n in [1..70]]; // Vincenzo Librandi, Jun 21 2017
    
  • Mathematica
    Join[{1}, LinearRecurrence[{1, 1, -1}, {5, 3, 9}, 60]] (* Vincenzo Librandi, Jun 21 2017 *)
  • PARI
    Vec((1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2) + O(x^100)) \\ Michel Marcus, Jun 21 2017

Formula

G.f.: (1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2).
a(n) = n + abs(2 - (n + 1)*(-1)^n). - Lechoslaw Ratajczak, Dec 09 2016
a(n) = 2*A065190(n+1)-1 and a(n) = 2*A014681(n)+1. - Michel Marcus, Dec 10 2016
From Guenther Schrack, Jun 09 2017: (Start)
a(n) = 2*n + 1 - 2*(-1)^n for n > 0.
a(n) = 2*n + 1 - 2*cos(n*Pi) for n > 0.
a(n) = 4*n - a(n-1) for n > 1.
Linear recurrence: a(n) = a(n-1) + a(n-2) - a(n-3) for n > 3.
First differences: 2 - 4*(-1)^n for n > 1; -(-1)^n*A010696(n) for n > 1.
a(n) = A065164(n+1) + n for n > 0.
a(A014681(n)) = A005408(n) for n >= 0.
a(A005408(A014681(n)) for n >= 0.
a(n) = A005408(A103889(n)) for n >= 0.
A103889(a(n)) = 2*A065190(n+1) for n >= 0.
a(2*n-1) = A004766(n) for n > 0.
a(2*n+2) = A004767(n) for n >= 0. (End)

A133256 a(4*n+1) = 4*n+1, a(4*n+2) = 4*n+2, a(4*n+3) = 4*n+4, a(4*n+4) = 4*n+3.

Original entry on oeis.org

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

Views

Author

Paul Curtz, Oct 15 2007

Keywords

Comments

A permutation of the positive integers, swapping consecutive values congruent to 3 and 4 (mod 4). - Franklin T. Adams-Watters, Jan 22 2012.
This is the lexicographically earliest sequence of distinct positive integers such that no polynomial of degree d can be fitted to d+2 consecutive terms (equivalently, such that no iterated difference is zero). - Pontus von Brömssen, Dec 26 2021

Crossrefs

Cf. A103889.

Programs

  • Mathematica
    Table[Which[Mod[n,4]==3,n+1,Divisible[n,4],n-1,True,n],{n,40}] (* or *) Partition[Range[40],4]/.{a_,b_,c_,d_}->{a,b,d,c}//Flatten (* Harvey P. Dale, Aug 29 2016 *)

Formula

From Chai Wah Wu, Sep 10 2020: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
G.f.: x*(x^4 - x^3 + 2*x^2 + x + 1)/(x^5 - x^4 - x + 1). (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 - log(2)/2. - Amiram Eldar, Jan 31 2023

Extensions

Definition fixed and offset changed by Franklin T. Adams-Watters, Jan 22 2012

A292576 Permutation of the natural numbers partitioned into quadruples [4k-1, 4k-3, 4k-2, 4k], k > 0.

Original entry on oeis.org

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

Views

Author

Guenther Schrack, Sep 19 2017

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the second and third elements, then swap the first and the second element; repeat for all quadruples.

Crossrefs

Inverse: A056699(n+1) - 1 for n > 0.
Sequence of fixed points: A008586(n) for n > 0.
Subsequences:
elements with odd index: A042964(A103889(n)) for n > 0.
elements with even index: A042948(n) for n > 0.
odd elements: A166519(n) for n>0.
indices of odd elements: A042963(n) for n > 0.
even elements: A005843(n) for n>0.
indices of even elements: A014601(n) for n > 0.
Sum of pairs of elements:
a(n+2) + a(n) = A163980(n+1) = A168277(n+2) for n > 0.
Difference between pairs of elements:
a(n+2) - a(n) = (-1)^A011765(n+3)*A091084(n+1) for n > 0.
Compound relations:
a(n) = A284307(n+1) - 1 for n > 0.
a(n+2) - 2*a(n+1) + a(n) = (-1)^A011765(n)*A132400(n+1) for n > 0.
Compositions:
a(n) = A116966(A080412(n)) for n > 0.
a(A284307(n)) = A256008(n) for n > 0.
a(A042963(n)) = A166519(n-1) for n > 0.
A256008(a(n)) = A056699(n) for n > 0.

Programs

  • MATLAB
    a = [3 1 2 4]; % Generate b-file
    max = 10000;
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • PARI
    for(n=1, 10000, print1(n + ((-1)^(n*(n-1)/2)*(2 - (-1)^n) - (-1)^n)/2, ", "))

Formula

a(1)=3, a(2)=1, a(3)=2, a(4)=4, a(n) = a(n-4) + 4 for n > 4.
O.g.f.: (2*x^3 + x^2 - 2*x + 3)/(x^5 - x^4 - x + 1).
a(n) = n + ((-1)^(n*(n-1)/2)*(2-(-1)^n) - (-1)^n)/2.
a(n) = n + (cos(n*Pi/2) - cos(n*Pi) + 3*sin(n*Pi/2))/2.
a(n) = n + n mod 2 + (ceiling(n/2)) mod 2 - 2*(floor(n/2) mod 2).
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
First Differences, periodic: (-2, 1, 2, 3), repeat; also (-1)^A130569(n)*A068073(n+2) for n > 0.

A307485 A permutation of the nonnegative integers: one odd, two even, four odd, eight even, etc.; extended to nonnegative integer with a(0) = 0.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Apr 18 2019

Keywords

Comments

The simple idea of "list the first odd number, first two even numbers, next four odd numbers, next eight even numbers..." leads to a permutation of the positive integers, which can quite naturally be extended to a permutation of the nonnegative integers, with a(0) = 0.

Examples

			The first odd number is a(1) = 1,
the first two even numbers are a(2..3) = (2, 4),
the next four odd numbers are a(4..7) = (3, 5, 7, 9),
the next eight even numbers are a(8..15) = (6, 8, ..., 20), etc.
the next sixteen odd numbers are a(16..31) = (11, 13, ..., 41),
the next thirty-two even numbers are a(32..63) = (22, 24, ..., 84), etc.
the next 64 odd numbers are a(64..127) = (43, 45, ..., 169),
the next 128 even numbers are a(128..255) = (86, 88, ..., 340), etc.
		

Crossrefs

Cf. A196521, A307613 (inverse permutation), A307612 (partial sums).
Cf. A103889 (odd & even swapped), A004442 (pairs reversed: n + (-1)^n).
Odd numbers: A005408. Even numbers: A005843.
Cf. A233275 (different permutation based on entangling odd & even numbers).

Programs

  • Mathematica
    Join[{0},Flatten[Riffle[TakeList[Range[1,169,2],2^Range[0,6,2]],TakeList[Range[ 2,340,2],2^Range[ 1,7,2]]]]] (* Harvey P. Dale, Dec 17 2022 *)
  • PARI
    A307485(n)=2*n-2^logint(n<<2+1,2)\3

Formula

Ignoring a(0) = 0, the k-th block (k >= 1) has 2^(k-1) terms, indexed from 2^(k-1) through 2^k-1, all having the same parity as k.
The difference between the last and the first term of this range is: a(2^k-1) - a(2^(k-1)) = 2^k - 2 = (2^(k-1) - 1)*2 = (starting index - 1) times two = ending index minus one.
The 1st, 3rd, ..., (2n+1)-th block = (n+1)-th odd block starts with A007583(n) = (1, 3, 11, 43, 171, ...), n >= 0.
The 2nd, 4th, ..., (2n+2)-th block = (n+1)-th even block starts with 2*A007583(n) = (2, 6, 22, 86, 342, ...), n >= 0, i.e., twice the starting value of the preceding odd block.
a(n) = 2*n - floor(2^k/3) where k = floor(log_2(4n+1)), n >= 0. (And 2^k == (-1)^k (mod 3) => floor(2^k/3) = (2^k-m)/3 with m = 1 if k even, m = 2 if k odd.)
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 - log(2)/2 (A196521). - Amiram Eldar, Nov 28 2023

A168198 a(n) = 3*n - a(n-1) + 1 with n > 1, a(1)=1.

Original entry on oeis.org

1, 6, 4, 9, 7, 12, 10, 15, 13, 18, 16, 21, 19, 24, 22, 27, 25, 30, 28, 33, 31, 36, 34, 39, 37, 42, 40, 45, 43, 48, 46, 51, 49, 54, 52, 57, 55, 60, 58, 63, 61, 66, 64, 69, 67, 72, 70, 75, 73, 78, 76, 81, 79, 84, 82, 87, 85, 90, 88, 93, 91, 96, 94, 99, 97, 102, 100, 105, 103, 108
Offset: 1

Views

Author

Vincenzo Librandi, Nov 20 2009

Keywords

Comments

Alternately add 5 and subtract 2, starting with 1. Apparently this was a test question: Find the next two numbers after 1,6,4,9,7,12,10. - N. J. A. Sloane, Dec 18 2010

Examples

			From _Muniru A Asiru_, Mar 20 2018: (Start)
For n = 2, a(2) = 3*2 - a[2-1] + 1 = 6 - a[1] + 1 = 6 - 1 + 1 = 6.
For n = 3, a(3) = 3*3 - a[3-1] + 1 = 9 - a[2] + 1 = 9 - 6 + 1 = 4.
For n = 4, a(4) = 3*4 - a[4-1] + 1 = 12 - a[3] + 1 = 12 - 4 + 1 = 9.
... (End)
		

Crossrefs

Programs

  • GAP
    a:=[1];; for n in [2..80] do a[n]:=3*n-a[n-1]+1; od; a; # Muniru A Asiru, Mar 20 2018
  • Magma
    I:=[1,6,4]; [n le 3 select I[n] else Self(n-1)+Self(n-2)-Self(n-3): n in [1..60]]; // Vincenzo Librandi, Feb 28 2012
    
  • Maple
    a:= proc(n) option remember: if n = 1 then 1 elif n >= 2 then 3*n - procname(n-1) + 1 fi; end:
    seq(a(n), n = 1..70); # Muniru A Asiru, Mar 20 2018
  • Mathematica
    LinearRecurrence[{1,1,-1},{1,6,4},100] (* Vincenzo Librandi, Feb 28 2012 *)
  • PARI
    a(n)=(6*n+5+7*(-1)^n)/4 \\ Charles R Greathouse IV, Jan 11 2012
    

Formula

a(n) = (6*n + 5 + 7*(-1)^n)/4. - Jon E. Schoenfield, Jun 24 2010
G.f.: x*(1+5*x-3*x^2)/((1+x)(1-x)^2). - Bruno Berselli, Feb 28 2012
Sum_{n>=1} (-1)^(n+1)/a(n) = 1/3 + Pi/(6*sqrt(3)) + log(3)/2. - Amiram Eldar, Feb 23 2023
Previous Showing 11-20 of 32 results. Next