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.

User: Edwin F. Sampang

Edwin F. Sampang's wiki page.

Edwin F. Sampang has authored 9 sequences.

A181672 The odd terms (a1,a3,a5,...) are in an arithmetic progression (1,2,3,...), while the even terms (a2,a4,a6,...) give the number of letters of the given odd term.

Original entry on oeis.org

1, 3, 2, 3, 3, 5, 4, 4, 5, 4, 6, 3, 7, 5, 8, 5, 9, 4, 10, 3, 11, 6, 12, 6, 13, 8, 14, 8, 15, 7, 16, 7, 17, 9, 18, 8, 19, 8, 20, 6, 21, 9, 22, 9, 23, 11, 24, 10, 25, 10, 26, 9, 27, 11, 28, 11, 29, 10, 30, 6, 31, 9, 32, 9, 33, 11, 34, 10
Offset: 1

Author

Edwin F. Sampang, Nov 04 2010

Keywords

Examples

			(ONE - 3 letters, TWO - 3 letters, THREE - 5 letters, FOUR - 4 letters, FIVE - 4 letters...)
		

Formula

a(2n-1) = n.
a(2n) = A005589(n).

Extensions

More terms from Nathaniel Johnston, Nov 15 2010

A130312 Each Fibonacci number F(n) appears F(n) times.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34
Offset: 1

Author

Edwin F. Sampang, May 21 2007

Keywords

Comments

Also n-1-s(n-1), where s(n) is the length of the longest proper suffix of p, the length-n prefix of the infinite Fibonacci word (A003849), that appears twice in p. - Jeffrey Shallit, Mar 20 2017
a(n+1) = the least period of the length-n prefix of the infinite Fibonacci word (A003849). A period of a length-n word x is an integer p, 1 <= p <= n such that x[i] = x[i+p] for 1 <= i <= n-p. - Jeffrey Shallit, May 23 2020
a(n) is the largest term in dual Zeckendorf representation of n-1 (A104326), for n >= 2. - Amiram Eldar, Aug 09 2024

Examples

			As triangle:
   1;
   1;
   2,  2;
   3,  3,  3;
   5,  5,  5,  5,  5;
   8,  8,  8,  8,  8,  8,  8,  8;
  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13;
  ...
		

Crossrefs

Programs

  • Maple
    T:= n-> (f-> f$f)((<<0|1>, <1|1>>^n)[1,2]):
    seq(T(n), n=1..10);  # Alois P. Heinz, Nov 23 2024
  • Mathematica
    Flatten[Table[#,{#}]&/@Fibonacci[Range[10]]] (* Harvey P. Dale, Apr 18 2012 *)
  • PARI
    a(n) = my(m=0); until(fibonacci(m)>n, m++); fibonacci(m-2); \\ Michel Marcus, Nov 26 2022
  • Python
    from itertools import islice
    def A130312_gen(): # generator of terms
        a, b = 1, 1
        while True:
            yield from (a,)*a
            a, b = b, a+b
    A130312_list = list(islice(A130312_gen(),20)) # Chai Wah Wu, Oct 13 2022
    
  • Python
    def A130312(n):
        a, b = 0, 1
        while (c:=a+b) <= n: a, b = b, c
        return a # Chai Wah Wu, Nov 23 2024
    

Formula

a(n) = A000045(A072649(n)). - Michel Marcus, Aug 03 2022

Extensions

More terms from Harvey P. Dale, Apr 18 2012

A129188 n + n-th prime + n-th composite.

Original entry on oeis.org

7, 11, 16, 20, 26, 31, 38, 42, 48, 57, 62, 70, 76, 81, 87, 95, 103, 107, 116, 123, 127, 135, 141, 149, 160, 166, 170, 177, 182, 188, 204, 211, 219, 223, 235, 239, 248, 256, 262, 270, 278, 283, 296, 300, 306, 310, 324, 339, 345, 349, 356, 365, 369, 381, 389, 397
Offset: 1

Author

Edwin F. Sampang, Apr 01 2007

Keywords

Examples

			a(1)=1+2+4, a(2)=2+3+6, a(3)=3+5+8, a(4)=4+7+9.
		

Programs

  • Maple
    c:=proc(n) if isprime(n)=false then n else fi end: C:=[seq(c(n),n=2..100)]: a:=n->ithprime(n)+C[n]+n: seq(a(n),n=1..70); # Emeric Deutsch, Apr 16 2007
  • Mathematica
    prs=Prime[Range[200]]; comps=Rest[Complement[Range[prs[[-1]]], prs]]; Table[n + prs[[n]] + comps[[n]], {n, Length[prs]}] (* Harvey P. Dale, Jan 11 2011 *)

Formula

a(n) = n+A064799(n). - R. J. Mathar, Nov 25 2008

A129189 n-th prime + n-th composite - n.

Original entry on oeis.org

5, 7, 10, 12, 16, 19, 24, 26, 30, 37, 40, 46, 50, 53, 57, 63, 69, 71, 78, 83, 85, 91, 95, 101, 110, 114, 116, 121, 124, 128, 142, 147, 153, 155, 165, 167, 174, 180, 184, 190, 196, 199, 210, 212, 216, 218, 230, 243, 247, 249, 254, 261, 263, 273, 279, 285, 292, 294
Offset: 1

Author

Edwin F. Sampang, Apr 01 2007

Keywords

Examples

			n(1)=2+4-1, n(2)=3+6-2, n(3)=5+8-3, n(4)=7+9-4, n(5)=11+10-5.
		

Programs

  • Maple
    c:=proc(n) if isprime(n)=false then n else fi end: C:=[seq(c(n),n=2..100)]: a:=n->ithprime(n)+C[n]-n: seq(a(n),n=1..74); # Emeric Deutsch, Apr 16 2007
  • Mathematica
    Module[{nn=80,prs,cmps,len},prs=Prime[Range[nn]];cmps=Complement[ Range[ 2,2nn],prs];len=Min[nn,Length[cmps]];#[[1]]+#[[2]]-#[[3]]&/@ Thread[ {Take[ prs,len],Take[cmps,len],Range[len]}]] (* Harvey P. Dale, Oct 05 2016 *)

Formula

a(n) = A064799(n) - n. - Michel Marcus, Mar 14 2014

Extensions

More terms from Emeric Deutsch, Apr 16 2007

A129131 Alternately write composite and prime numbers.

Original entry on oeis.org

4, 2, 6, 3, 8, 5, 9, 7, 10, 11, 12, 13, 14, 17, 15, 19, 16, 23, 18, 29, 20, 31, 21, 37, 22, 41, 24, 43, 25, 47, 26, 53, 27, 59, 28, 61, 30, 67, 32, 71, 33, 73, 34, 79, 35, 83, 36, 89, 38, 97, 39, 101, 40, 103, 42, 107, 44, 109, 45, 113, 46, 127, 48, 131, 49, 137, 50, 139, 51
Offset: 1

Author

Edwin F. Sampang, Mar 30 2007

Keywords

Comments

a(2n-1) = A073846(2n+1), a(2n) = A073846(2n).

Examples

			Lowest composite number is 4, lowest prime number is 2, next composite number after 4 is 6, next prime number after 2 is 3 and so on.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A073846 (alternate nonprime and prime numbers).

Programs

  • Magma
    P:=[ n : n in [2..150] | IsPrime(n) ]; C:=[ n : n in [2..70] | not IsPrime(n) ]; &cat[ [C[k], P[k] ]: k in [1..Minimum(#C, #P)] ]; // Klaus Brockhaus, Mar 31 2007
  • Mathematica
    f[n_]:=Module[{prs=Prime[Range[n]],comps},comps=Rest[Complement[Range[n+ Length[prs]+1], prs]];Riffle[comps,prs]] (* Harvey P. Dale, May 10 2011 *)

Formula

a(n) = A066249(n) + 1. - Filip Zaludek, Dec 10 2016

Extensions

Edited and extended by Klaus Brockhaus, Mar 31 2007

A113683 a(n)=a(n-1)/3 if a(n-1)=0(mod 3), a(n)=4*a(n-1)+2 if a(n-1)=1(mod 3), a(n)=4*a(n-1)-2 if a(n-1)=2(mod 3).

Original entry on oeis.org

10, 42, 14, 54, 18, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2
Offset: 0

Author

Edwin F. Sampang, Nov 04 2005

Keywords

Programs

  • Mathematica
    a[0] = 10; a[n_] := a[n] = Switch[ Mod[a[n - 1], 3], 0, a[n - 1]/3, 1, 4a[n - 1] + 2, 2, 4a[n - 1] - 2]; Table[ a[n], {n, 0, 102}] (* Robert G. Wilson v, Nov 10 2005 *)
    nxt[a_]:=Module[{m=Mod[a,3]},Which[m==0,a/3,m==1,4a+2,m==2,4a-2]]; NestList[ nxt,10,110] (* or *) PadRight[{10,42,14,54,18},120,{2,6}] (* Harvey P. Dale, Feb 19 2018 *)

A112447 a(2*n) = A001045(n+2); a(2*n+1) = A001045(n+1).

Original entry on oeis.org

1, 1, 3, 1, 5, 3, 11, 5, 21, 11, 43, 21, 85, 43, 171, 85, 341, 171, 683, 341, 1365, 683, 2731, 1365, 5461, 2731, 10923, 5461, 21845, 10923, 43691, 21845, 87381, 43691, 174763, 87381, 349525, 174763, 699051, 349525, 1398101, 699051, 2796203, 1398101, 5592405
Offset: 0

Author

Edwin F. Sampang, Dec 12 2005

Keywords

Comments

Consider the Harmonacci sequence: H(1)=x, H(2)=y, H(3)=2xy/(x+y), H(4)=4xy/(3x+y)...; H(m) is the harmonic mean of H(m-1) and H(m-2). a(2n) and a(2n+1) are the denominator coefficients of H(n+3).

Crossrefs

Cf. A001045.

Programs

  • Mathematica
    LinearRecurrence[{0,1,0,2},{1,1,3,1},50] (* Harvey P. Dale, May 30 2018 *)
  • PARI
    Vec((1 + x + 2*x^2) / ((1 + x^2)*(1 - 2*x^2)) + O(x^60)) \\ Colin Barker, Dec 15 2017

Formula

a(n) = (a(n-1)+1)/2 for n=2, 6, 10...
a(n) = 4*a(n-1)-1 for n=3, 7, 11...
a(n) = (a(n-1)-1)/2 for n=4, 8, 12...
a(n) = 4*a(n-1)+1 for n=5, 9, 13....
From Colin Barker, Dec 15 2017: (Start)
G.f.: (1 + x + 2*x^2) / ((1 + x^2)*(1 - 2*x^2)).
a(n) = a(n-2) + 2*a(n-4) for n>3.
(End)

Extensions

Edited by Don Reble, Jan 25 2006

A112387 a(n) = 2^(n/2) if n is even and a(n-1) - a(n-2) if n is odd, a(1) = 1.

Original entry on oeis.org

1, 1, 2, 1, 4, 3, 8, 5, 16, 11, 32, 21, 64, 43, 128, 85, 256, 171, 512, 341, 1024, 683, 2048, 1365, 4096, 2731, 8192, 5461, 16384, 10923, 32768, 21845, 65536, 43691, 131072, 87381, 262144, 174763, 524288, 349525, 1048576, 699051, 2097152, 1398101, 4194304
Offset: 0

Author

Edwin F. Sampang, Dec 05 2005

Keywords

Comments

This sequence originated from the Fibonacci sequence, but instead of adding the last two terms, you get the average. Example, if you have the initial condition a(1)=x and a(2)=y, a(3)=(x+y)/2, a(4)=(x+3y)/4, a(5)=(3x+5y)/8, a(6)=(5x+11y)/16 and so on and so forth. I used the coefficients of x and y as well as the denominator.
As n approaches infinity a(n)/a(n+1) oscillates between the values 3/2 and 1/3.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n::even, 2^(n/2), a(n-1)-a(n-2))
        end: a(1):=1:
    seq(a(n), n=0..50);  # Alois P. Heinz, Sep 27 2023
  • Mathematica
    a[1] = 1; a[2] = 2; a[n_] := a[n] = If[ EvenQ[n], 2^(n/2), a[n - 1] - a[n - 2]]; Array[a, 43] (* Robert G. Wilson v, Dec 05 2005 *)
    nxt[{n_,a_,b_}]:={n+1,b,If[OddQ[n],2^((n+1)/2),b-a]}; NestList[nxt,{2,1,2},50][[All,2]] (* Harvey P. Dale, Jul 08 2019 *)

Formula

a(n) = 2^(n/2) if n is even, a(n) = a(n-1) - a(n-2) if n is odd, and a(1) = 1.
a(2n) = A000079(n), a(2n-1) = A001045(n).
G.f.: (1+x+x^2)/((1+x^2)*(1-2*x^2)). - Joerg Arndt, Apr 25 2021
a(n) = A135318(n + (-1)^n). - Paul Curtz, Sep 27 2023
E.g.f.: (3*cosh(sqrt(2)*x) + sin(x) + sqrt(2)*sinh(sqrt(2)*x))/3. - Stefano Spezia, Jun 30 2024
a(2*n) + a(2*n+1) = A048573(n); a(2*n+1) + a(2*n+2) = A001045(n+3). - Paul Curtz, Jan 03 2025

Extensions

Edited and extended by Robert G. Wilson v, Dec 05 2005
a(0)=1 prepended by Alois P. Heinz, Sep 27 2023

A110044 a(0) = 11, a(1) = 23; for n > 1, a(n) = |a(n-1) - a(n-2)|.

Original entry on oeis.org

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

Author

Edwin F. Sampang, Jul 09 2005

Keywords

Comments

Since a(18)=a(19)=1, starting from here the sequence is periodic with period 3: 1,1,0,1,1,0,1,1,0,... - Emeric Deutsch, Jul 13 2005

Crossrefs

Cf. A141571.

Programs

  • Maple
    a[0]:=11: a[1]:=23: for n from 2 to 120 do a[n]:=abs(a[n-1]-a[n-2]) od: seq(a[n],n=0..120); # Emeric Deutsch, Jul 13 2005
  • Mathematica
    Join[{11, 23, 12, 11, 1, 10, 9, 1, 8, 7, 1, 6, 5, 1, 4, 3, 1, 2},LinearRecurrence[{0, 0, 1},{1, 1, 0},85]] (* Ray Chandler, Aug 25 2015 *)

Formula

a(n) = 2/3 + 1/3*cos(2*Pi*n/3) + 1/3*3^(1/2)*sin(2*Pi*n/3) for n >= 19. - Richard Choulet, Dec 12 2008

Extensions

More terms from Emeric Deutsch, Jul 13 2005