A268393 Positions of records in permutation A267107.
1, 2, 4, 8, 15, 28, 52, 99, 193, 377, 739, 1459, 2908, 5799, 11537, 23021, 45971, 91857, 183513
Offset: 1
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.
ans:=[0]; ct:=0; for n from 2 to 2000 do p:=ithprime(n); if (p mod 4) = 3 then ct:=ct+1; else ct:=ct-1; fi; ans:=[op(ans),ct]; od: ans; # N. J. A. Sloane, Jun 24 2016
FoldList[Plus, 0, Mod[Prime[Range[2,110]], 4] - 2] Join[{0},Accumulate[If[Mod[#,4]==3,1,-1]&/@Prime[Range[2,110]]]] (* Harvey P. Dale, Apr 27 2013 *)
for(n=2,100,print1(sum(i=2,n,(-1)^((prime(i)+1)/2)),","))
from sympy import nextprime; a, p = 0, 2; R = [a] for _ in range(2,88): p=nextprime(p); a += p%4-2; R.append(a) print(*R, sep = ', ') # Ya-Ping Lu, Jan 18 2025
Comments