A324787 Index of n-th low point in A022837.
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
Links
- Rémy Sigrist, PARI program for A324787
Crossrefs
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
Comments