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

A008348 a(0)=0; thereafter a(n) = a(n-1) + prime(n) if a(n-1) < prime(n), otherwise a(n) = a(n-1) - prime(n).

Original entry on oeis.org

0, 2, 5, 0, 7, 18, 5, 22, 3, 26, 55, 24, 61, 20, 63, 16, 69, 10, 71, 4, 75, 2, 81, 164, 75, 172, 71, 174, 67, 176, 63, 190, 59, 196, 57, 206, 55, 212, 49, 216, 43, 222, 41, 232, 39, 236, 37, 248, 25, 252, 23, 256, 17, 258, 7, 264, 1, 270, 541, 264, 545, 262, 555
Offset: 0

Views

Author

Keywords

Comments

a(n) < 2*prime(n). Conjecture: a(n) > 0 for n > 3. - Thomas Ordowski, Dec 03 2016 [This conjecture is false, because a(369019)=0. The next counterexample occurs at n = 22877145. - Dmitry Kamenetsky, Feb 14 2017. (Cf. A309225.)]

Crossrefs

Programs

  • Maple
    A008348 := proc(n) option remember; if n = 0 then 0 elif A008348(n-1)>=ithprime(n) then A008348(n-1)-ithprime(n); else A008348(n-1)+ithprime(n); fi; end;
    # Maple from N. J. A. Sloane, Aug 31 2019 (Start)
    # Riecaman transform
    Riecaman := proc(a,s,M)
    # Start with s, add or subtract a[n], get M terms. If a has w terms, can get M=w+1 terms.
    local b,M2,n,t;
    if whattype(a) <> list then ERROR("First argument should be a list"); fi;
    if a[1]=0 then ERROR("a[1] should not be zero"); fi;
    M2 := min(nops(a),M-1);
    b:=[s]; t:=s;
    for n from 1 to M2 do
       if a[n]>t then t:=t+a[n] else t:=t-a[n]; fi; b:=[op(b),t]; od:
    b; end;
    # Riecaman transform of primes, starting at s=0
    p1:=[seq(ithprime(i),i=1..100)];
    q0:=Riecaman(p1,0,99);
    # End
  • Mathematica
    a := {0}; For[n = 2, n < 100, n++, If[a[[n - 1]] >= Prime[n - 1], b := a[[n - 1]] - Prime[n - 1], b := a[[n - 1]] + Prime[n - 1];]; a = Append[a, b]]; a (* Stefan Steinerberger, May 02 2006 *)
    nxt[{n_,a_}]:={n+1,If[aHarvey P. Dale, Sep 13 2024 *)
  • PARI
    lista(nn) = {print1(a=0, ", "); for (n=1, nn, if (a < (p=prime(n)), a += p, a -= p); print1(a, ", "););} \\ Michel Marcus, Dec 04 2016

Formula

a(n) = c(1)p(1) + ... + c(n)p(n), where c(i) = 1 if a(i-1) > p(i) and c(i) = -1 if a(i-1) <= p(i) (p(i) = primes). - Clark Kimberling

Extensions

More terms from Clark Kimberling
Name edited by Dmitry Kamenetsky, Feb 14 2017

A324787 Index of n-th low point in A022837.

Original entry on oeis.org

2, 5, 12, 29, 78, 199, 508, 1355, 3592, 9589, 25752, 70579, 194228, 539961, 1507602, 4228745, 11913940, 33690443, 95581182, 272003821, 776082524, 2219823175, 6363074656
Offset: 0

Views

Author

N. J. A. Sloane, Sep 04 2019

Keywords

Comments

A "low point" in a sequence is a term which is less than the previous term (this condition is skipped for the initial term) and which is followed by two or more increases.

Crossrefs

If the basic sequence (A022837) began with 0 instead of 1 we would get A008348, A309226, A324782, A324783, A309225.

Programs

  • Maple
    Riecaman := proc(a,s,M)
    # Start with s, add or subtract a[n], get M terms. If a has w terms, can get M=w+1 terms.
    local b,M2,n,t;
    if whattype(a) <> list then ERROR("First argument should be a list"); fi;
    if a[1]=0 then ERROR("a[1] should not be zero"); fi;
    M2 := min(nops(a),M-1);
    b:=[s]; t:=s;
    for n from 1 to M2 do
       if a[n]>t then t:=t+a[n] else t:=t-a[n]; fi; b:=[op(b),t]; od:
    b; end;
    blocks := proc(a,S) local b,c,d,M,L,n;
    # Given a list a, whose leading term has index S, return [b,c,d], where b lists the indices of the low points in a, c lists the values of a at the low points, and d lists the length of runs between the low points.
    b:=[]; c:=[]; d:=[]; L:=1;
    # if a[1] a low point?
       n:=1;
       if( (a[n+1]>a[n]) and (a[n+2]>a[n+1]) ) then
       b:=[op(b),n+S-1]; c:=[op(c),a[n]]; d:=[op(d), n-L]; L:=n; fi;
    for n from 2 to nops(a)-2 do
    # if a[n] a low point?
       if( (a[n-1]>a[n]) and (a[n+1]>a[n]) and (a[n+2]>a[n+1]) ) then
       b:=[op(b),n+S-1]; c:=[op(c),a[n]]; d:=[op(d), n-L]; L:=n; fi; od;
    [b,c,d]; end;
    p0:=[seq(ithprime(n),n=1..100001)]:
    q1:=Riecaman(p0,1,100000):
    blocks(q1,0); # produces [the present sequence, A324788, A324789]
  • PARI
    See Links section.

Extensions

Modified definition to make offset 0. - N. J. A. Sloane, Oct 02 2019
a(12)-a(22) from Rémy Sigrist, Oct 18 2020

A324790 Indices of zeros in A022837.

Original entry on oeis.org

2, 12, 508, 3592, 25752, 1507602
Offset: 1

Views

Author

N. J. A. Sloane, Sep 04 2019

Keywords

Comments

For k > 0, A022837(2*k-1) is odd and A022837(2*k) is even. So a(n) is even. - Seiichi Manyama, Sep 06 2019
If it exists, a(7) > 10^10. - Michael S. Branicky, Sep 02 2024

Crossrefs

Cf. A022837, A309225. See A324787 for further information.

Extensions

a(5)-a(6) from Seiichi Manyama, Sep 05 2019
Showing 1-3 of 3 results.