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.

A140201 Partial sums of A140081.

Original entry on oeis.org

0, 1, 2, 4, 4, 5, 6, 8, 8, 9, 10, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 24, 24, 25, 26, 28, 28, 29, 30, 32, 32, 33, 34, 36, 36, 37, 38, 40, 40, 41, 42, 44, 44, 45, 46, 48, 48, 49, 50, 52, 52, 53, 54, 56, 56, 57, 58, 60, 60, 61, 62, 64, 64, 65, 66, 68, 68, 69, 70, 72, 72, 73, 74
Offset: 0

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 09 2008

Keywords

Crossrefs

Programs

  • Magma
    I:=[0, 1, 2, 4, 4]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..80]]; // Vincenzo Librandi, Sep 17 2012
  • Maple
    A140201:=n->(4*n+1-I^(2*n)+(-I)^(1+n)+I^(1+n))/4: seq(A140201(n), n=0..100); # Wesley Ivan Hurt, Jun 04 2016
  • Mathematica
    Accumulate[PadRight[{}, 68, {0, 1, 1, 2}]] (* Harvey P. Dale, Aug 19 2011 *)

Formula

a(n) = A047624(n+1) - A042948(A004526(n)). - Reinhard Zumkeller, Feb 21 2010
a(n) = A002265(n+1) + A057353(n+1). - Reinhard Zumkeller, Feb 26 2011
From Bruno Berselli, Jan 27 2011: (Start)
G.f.: x*(1+x+2*x^2)/((1+x)*(1+x^2)*(1-x)^2).
a(n) = a(n-1) + a(n-4) - a(n-5) for n>4.
a(n) = n + A121262(n+1). (End)
a(n) = n when n+1 is not a multiple of 4, and a(n) = n+1 when n+1 is a multiple of 4. - Dennis P. Walsh, Aug 06 2012
a(n) = A004524(n+1) + A004526(n+1). - Arkadiusz Wesolowski, Sep 17 2012
a(n) = (4*n+1-i^(2*n)+(-i)^(1+n)+i^(1+n))/4 where i=sqrt(-1). - Wesley Ivan Hurt, Jun 04 2016
a(n) = n+1-(sign((n+1) mod 4) mod 3). - Wesley Ivan Hurt, Sep 26 2017

A116966 a(n) = n + {1,2,0,1} according as n == {0,1,2,3} mod 4.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 31 2006

Keywords

Comments

In each group of four consecutive numbers, swap 2nd and 3rd terms. - Zak Seidov, Mar 31 2006
First differences of A089781. - Reinhard Zumkeller, Aug 15 2015
From Guenther Schrack, May 31 2017: (Start)
Permutation of the positive integers partitioned into quadruples [4k+1,4k+3,4k+2,4k+4].
Partial sums: A116996. (End)

Crossrefs

Programs

  • Haskell
    a116966 n = a116966_list !! n
    a116966_list = zipWith (+) [0..] $ drop 2 a140081_list
    -- Reinhard Zumkeller, Aug 15 2015
  • Magma
    /* By definition: */ [ n + [1,2,0,1][1+(n mod 4)]: n in [0..70] ]; // Bruno Berselli, Nov 25 2012
    
  • Maple
    f:=proc(i) if i mod 4 = 0 then i+1 elif i mod 4 = 1 then i+2 elif i mod 4 = 2 then i else i+1; fi; end;
  • Mathematica
    b := {1, 2, 0, 1}; a[n_] := n + b[[1 + Mod[n, 4]]]; Table[a[n], {n, 0, 60}] (* Stefan Steinerberger, Mar 31 2006 *)
    CoefficientList[Series[(2 x^3 - x^2 + 2 x + 1) / ((x - 1)^2 (x + 1) (x^2 + 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Jun 19 2013 *)
  • Maxima
    makelist(n+1+(%i^(n*(n-1))-(-1)^n)/2, n, 0, 70); /* Bruno Berselli, Nov 25 2012 */
    
  • PARI
    Vec((2*x^3-x^2+2*x+1) / ((x-1)^2*(x+1)*(x^2+1)) + O(x^66) ) \\ Joerg Arndt, Apr 30 2013
    

Formula

a(n) = n+1+(i^(n(n-1))-(-1)^n)/2, where i=sqrt(-1). - Bruno Berselli, Nov 25 2012
G.f.: (2*x^3-x^2+2*x+1) / ((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Apr 30 2013
a(n) = A140081(n+2) + n. - Reinhard Zumkeller, Aug 15 2015
From Guenther Schrack, May 31 2017: (Start)
a(n) = n + 1 + ((-1)^(n*(n-1)/2) - (-1)^n)/2.
a(n) = a(n-4) + 4, n > 3.
a(n) = a(n-1) + a(n-4) - a(n-5), n > 4. (End)
Sum_{n>=0} (-1)^n/a(n) = Pi/4 + log(2)/2. - Amiram Eldar, Jan 31 2023

A140080 Fix e = 3; a(n) = minimal Hamming distance between the binary representation of n and the binary representation of any multiple ke (0 <= k <= n/e) which is a child of n.

Original entry on oeis.org

0, 1, 1, 0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 1, 1, 0, 1, 2, 0, 1, 2, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 2, 1, 0, 1, 1, 0, 2, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 2, 0, 1, 2, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 2, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1
Offset: 0

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 03 2008

Keywords

Comments

A number m is a child of n if the binary representation of n has a 1 in every position where the binary representation of m has a 1.
In other words, this tells us how closely (in Hamming weight) we can approximate n "from below" by a multiple of e.

Examples

			If n = 14 = 1110_2, take k=2, ke = 6 = 110_2, which is Hamming distance 1 from n. This is the best we can do, so a(14) = 1.
		

Crossrefs

For e=2 and 4 through 9 see A000035 and A140081 through A140086.

Programs

  • Fortran
    See Sloane link.

A047624 Numbers that are congruent to {0, 1, 3, 5} mod 8.

Original entry on oeis.org

0, 1, 3, 5, 8, 9, 11, 13, 16, 17, 19, 21, 24, 25, 27, 29, 32, 33, 35, 37, 40, 41, 43, 45, 48, 49, 51, 53, 56, 57, 59, 61, 64, 65, 67, 69, 72, 73, 75, 77, 80, 81, 83, 85, 88, 89, 91, 93, 96, 97, 99, 101, 104, 105, 107, 109, 112, 113, 115, 117, 120, 121, 123
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Magma
    [n : n in [0..150] | n mod 8 in [0, 1, 3, 5]]; // Wesley Ivan Hurt, Jun 01 2016
  • Maple
    A047624:=n->(8*n-11-I^(2*n)+I^(1-n)-I^(1+n))/4: seq(A047624(n), n=1..100); # Wesley Ivan Hurt, Jun 01 2016
  • Mathematica
    Table[(8n-11-I^(2n)+I^(1-n)-I^(1+n))/4, {n, 80}] (* Wesley Ivan Hurt, Jun 01 2016 *)
    LinearRecurrence[{1,0,0,1,-1},{0,1,3,5,8},100] (* G. C. Greubel, Jun 01 2016 *)

Formula

From Reinhard Zumkeller, Feb 21 2010: (Start)
a(n+1) = A173562(n) - A173562(n-1);
a(n+1) - a(n) = A140081(n-1) + 1;
a(n) = A140201(n-1) + A042948(A004526(n-1)). (End)
G.f.: x^2*(1+2*x+2*x^2+3*x^3) / ( (1+x)*(x^2+1)*(x-1)^2 ). - R. J. Mathar, Oct 08 2011
From Wesley Ivan Hurt, Jun 01 2016: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
a(n) = (8*n-11-i^(2*n)+i^(1-n)-i^(1+n))/4 where i=sqrt(-1).
a(2k) = A016813(k-1) for k>0, a(2k-1) = A047470(k). (End)
E.g.f.: (6 + sin(x) + (4*x - 5)*sinh(x) + (4*x - 6)*cosh(x))/2. - Ilya Gutkovskiy, Jun 01 2016
Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(2))*Pi/16 + (8-sqrt(2))*log(2)/16 + sqrt(2)*log(2+sqrt(2))/8. - Amiram Eldar, Dec 20 2021

A260181 Numbers whose last digit is prime.

Original entry on oeis.org

2, 3, 5, 7, 12, 13, 15, 17, 22, 23, 25, 27, 32, 33, 35, 37, 42, 43, 45, 47, 52, 53, 55, 57, 62, 63, 65, 67, 72, 73, 75, 77, 82, 83, 85, 87, 92, 93, 95, 97, 102, 103, 105, 107, 112, 113, 115, 117, 122, 123, 125, 127, 132, 133, 135, 137, 142, 143, 145, 147
Offset: 1

Views

Author

Wesley Ivan Hurt, Jul 17 2015

Keywords

Comments

Numbers ending in 2, 3, 5 or 7.
The subsequence of primes is A042993. - Michel Marcus, Jul 19 2015
From Wesley Ivan Hurt, Aug 15 2015, Sep 26 2015: (Start)
Ceiling(a(n)/2) = A047201(n).
Complement of (A197652 Union A262389). (End)

Crossrefs

Cf. A042993, A047201, A092620, subset of A118950.
Union of A017293, A017305, A017329 and A017353.
First differences are [1,2,2,5,...] = A002522(A140081(n-1)).

Programs

  • GAP
    a:=n->(5*n-4-(-1)^n+((3-(-1)^n)/2)*(-1)^((2*n+5-(-1)^n)/4))/2; List([1..60],n->a(n)); # Muniru A Asiru, Feb 16 2018
  • Magma
    [(5*n-4-(-1)^n+((3-(-1)^n) div 2)*(-1)^((2*n+5-(-1)^n) div 4))/2: n in [1..70]]; // Vincenzo Librandi, Jul 18 2015
    
  • Maple
    A260181:=n->(5*n-4-(-1)^n+((3-(-1)^n)/2)*(-1)^((2*n+5-(-1)^n)/4))/2: seq(A260181(n), n=1..100);
  • Mathematica
    CoefficientList[Series[(2 + x + 2 x^2 + 2 x^3 + 3 x^4)/((x - 1)^2*(1 + x + x^2 + x^3)), {x, 0, 100}], x]
    LinearRecurrence[{1, 0, 0, 1, -1}, {2, 3, 5, 7, 12}, 60] (* Vincenzo Librandi, Jul 18 2015 *)
    Table[(5n - 4 - (-1)^n + ((3 - (-1)^n)/2)*(-1)^((2*n + 5 - (-1)^n)/4))/2, {n, 100}] (* Wesley Ivan Hurt, Aug 11 2015 *)
  • PARI
    is(n)=my(m=digits(n));isprime(m[#m]) \\ Anders Hellström, Jul 19 2015
    
  • PARI
    A260181(n)=(n--)\4*10+prime(n%4+1) \\ is(n)=isprime(n%10) is much more efficient than the above. - M. F. Hasler, Sep 16 2016
    

Formula

G.f.: x*(2+x+2*x^2+2*x^3+3*x^4) / ((x-1)^2*(1+x+x^2+x^3)).
a(n) = a(n-1)+a(n-4)-a(n-5), n>5.
a(n) = (5*n-4-(-1)^n+((3-(-1)^n)/2)*(-1)^((2*n+5-(-1)^n)/4))/2.
Sum_{n>=1} (-1)^(n+1)/a(n) = (2*sqrt(5*sqrt(5+2*sqrt(5))) - 25*log(5) - 40*log(2) + 5*sqrt(5)*arccoth(843/2))/200. - Amiram Eldar, Jul 30 2024

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

Original entry on oeis.org

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

Views

Author

Guenther Schrack, Jan 18 2018

Keywords

Comments

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

Crossrefs

Inverse: A292576.
Sequence of fixed points: A008586(n) for n > 0.
First differences: (-1)^floor(n^2/4)*A068073(n-1) for n > 0.
Subsequences:
elements with odd index: A042963(A103889(n)) for n > 0.
elements with even index A014601(n) for n > 0.
odd elements: A166519(n-1) for n > 0.
indices of odd elements: A042964(n) for n > 0.
even elements: A005843(n) for n > 0.
indices of even elements: A042948(n) for n > 0.
Other similar permutations: A116966, A284307, A292576.

Programs

  • MATLAB
    a = [2 3 1 4];
    max = 10000;    % Generation of b-file.
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Nest[Append[#, #[[-4]] + 4] &, {2, 3, 1, 4}, 63] (* or *)
    Array[# + ((-1)^# + ((-1)^(# (# - 1)/2)) (1 - 2 (-1)^#))/2 &, 67] (* Michael De Vlieger, Jan 23 2018 *)
    LinearRecurrence[{1,0,0,1,-1},{2,3,1,4,6},70] (* Harvey P. Dale, Dec 12 2018 *)
  • PARI
    for(n=1, 100, print1(n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2, ", "))

Formula

O.g.f.: (3*x^3 - 2*x^2 + x + 2)/(x^5 - x^4 - x - 1).
a(1) = 2, a(2) = 3, a(3) = 1, a(4) = 4, a(n) = a(n-4) + 4 for n > 4.
a(n) = n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2.
a(n) = n + (cos(n*Pi) - cos(n*Pi/2) + 3*sin(n*Pi/2))/2.
a(n) = 2*floor((n+1)/2) - 4*floor((n+1)/4) + floor(n/2) + 2*floor(n/4).
a(n) = n + (-1)^floor((n-1)^2/4)*A140081(n) for n > 0.
a(n) = A056699(n+1) - 1, n > 0.
a(n+2) = A168269(n+1) - a(n), n > 0.
a(n+2) = a(n) + (-1)^floor((n+1)^2/4)*A132400(n+2) for n > 0.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
First differences: periodic, (1, -2, 3, 2) repeat.
Compositions:
a(n) = A080412(A116966(n-1)) for n > 0.
a(n) = A284307(A256008(n)) for n > 0.
a(A067060(n)) = A133256(n) for n > 0.
A116966(a(n+1)-1) = A092486(n) for n >= 0.
A056699(a(n)) = A256008(n) for n > 0.
Showing 1-6 of 6 results.