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

A096693 Balance index of each prime.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 4, 0, 0, 5, 1, 0, 0, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 1, 0, 1, 0, 1, 0, 2, 0, 2, 1, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

Robert G. Wilson v, Jun 26 2004

Keywords

Comments

a(n) = the number of values of k for which the n-th prime is equal to the arithmetic average of the k primes above and below it.
The average of the first n balance indexes appears to reach a global maximum of 0.588 when n = 85, (prime(85) = 439).

Examples

			a(3) = 1 because the third prime, 5, equals (3 + 7)/2.
a(16) = 3 because the sixteenth prime, 53, equals (47 + 59)/2 = (41 + 43 + 47 + 59 + 61 + 67)/6 = (31 + 37 + 41 + 43 + 47 + 59 + 61 + 67 + 71 + 73)/10.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{c = 0, k = 1, p = Prime[n], s = Plus @@ Table[ Prime[i], {i, n - 1, n + 1}]}, While[k != n - 1, If[s == (2k + 1)p, c++ ]; k++; s = s + Prime[n - k] + Prime[n + k]]; c]; Table[ f[n], {n, 105}]
  • PARI
    b-file generator: {max_n = 10^4; for (n = 1, max_n, c = 0; k = 1; p = prime(n); s = p; while (k < n, s = s + prime(n - k) + prime(n + k); if (s == (2 * k + 1) * p, c++); k++;); print(n " " c);) ;}

Extensions

Corrected and edited by Christopher Hunt Gribble, Apr 06 2010

A090403 Balanced primes: Primes which are both the arithmetic mean and median of a sequence of 2k+1 consecutive primes, for some k>0.

Original entry on oeis.org

5, 17, 29, 37, 53, 71, 79, 89, 137, 149, 151, 157, 173, 179, 193, 211, 227, 229, 257, 263, 281, 349, 353, 359, 373, 383, 397, 409, 419, 421, 433, 439, 487, 491, 563, 577, 593, 607, 631, 643, 653, 659, 677, 701, 709, 733, 751, 757, 787, 823, 827, 877, 947, 953
Offset: 1

Views

Author

Farideh Firoozbakht, Dec 07 2003

Keywords

Comments

Union, for all k>0, of (2k+1)-balanced prime numbers, i.e., balanced prime of order k, which are primes p_n such that (2k+1)*p_n = Sum_{i=n-k..n+k} p_i, where p_i is the i-th prime.

Examples

			17 is in the sequence because 17 = (7 + 11 + 13 + 17 + 19 + 23 + 29)/7, (k = 3).
29 is in the sequence because 29 = (5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59)/15, (k = 7).
37 is a member because 37 = (7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71)/17; 7 & 71 are eight primes away from 37.
		

Crossrefs

Programs

  • Mathematica
    t[n_] := (For[k=1, !(SameQ[1/(2k+1)Sum[Prime[i], {i, n-k, n+k}], Prime[n]])&& k < n-1, k++ ];k);b[n_] := If[t[n]
    				
  • PARI
    is_A090403(p)={my(s=0,n); isprime(p) & for(k=1,-1+n=primepi(p),(s+=prime(n+k)+prime(n-k)-2*p)||return(1);s>p & return)} \\ M. F. Hasler, Oct 21 2012

Extensions

Definition corrected by Franklin T. Adams-Watters, Apr 13 2006
Edited by M. F. Hasler, Oct 21 2012
Showing 1-2 of 2 results.