OFFSET
1,1
COMMENTS
Suppose that (s(i)) is a strictly increasing sequence in the set N of positive integers. For i in N, let r(h) be the residue of s(i+h)-s(i) mod n, for h=1,2,...,n+1. There are at most n distinct residues r(h), so that there must exist numbers h and h' such that r(h)=r(h'), where 0<=h<h'<=n. Then s(i+h) is congruent mod n to s(i+h'), so that there exist j and k in N such that j<k and n divides s(k)-s(j). Let k(n) be the least k for which such j exists, and let j(n)=j. The pair (k,j) will be called the "least pair for which n divides s(k)-s(j)." (However, starting with "least j for which there is a k" yields pairs (k,j) which differ from those already described.)
Corollary: for each n, there are infinitely many pairs (j,k) such that n divides s(k)-s(j), and this result holds if s is assumed unbounded, rather than strictly increasing.
Guide to related sequences:
...
s(n)=prime(n), primes
s(n)=prime(n+1), odd primes
s(n)=prime(n+2), primes >=5
s(n)=prime(n)*prime(n+1) product of consecutive primes
s(n)=(prime(n+1)+prime(n+2))/2: averages of odd primes
s(n)=2^(n-1), powers of 2
s(n)=2^n, powers of 2
s(n)=C(n+1,2), triangular numbers
s(n)=n^2, squares
s(n)=(2n-1)^2, odd squares
s(n)=n(3n-1), pentagonal numbers
s(n)=n(2n-1), hexagonal numbers
s(n)=C(2n-2,n-1), central binomial coefficients
s(n)=(1/2)C(2n,n), (1/2)*(central binomial coefficients)
s(n)=n(n+1), oblong numbers
s(n)=n!, factorials
s(n)=n!!, double factorials
s(n)=3^n-2^n
s(n)=Fibonacci(n+1)
s(n)=Fibonacci(2n-1)
s(n)=Fibonacci(2n)
s(n)=Lucas(n)
s(n)=n*(2^(n-1))
s(n)=ceiling[n^2/2]
s(n)=floor[(n+1)^2/2]
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
Let s(k)=prime(k). As in A204890, the ordering of differences s(k)-s(j), follows from the arrangement shown here:
k...........1..2..3..4..5...6...7...8...9
s(k)........2..3..5..7..11..13..17..19..23
...
s(k)-s(1)......1..3..5..9..11..15..17..21..27
s(k)-s(2).........2..4..8..10..14..16..20..26
s(k)-s(3)............2..6..8...12..14..18..24
s(k)-s(4)...............4..6...10..12..16..22
...
least (k,j) such that 1 divides s(k)-s(j) for some j is (2,1), so a(1)=2.
least (k,j) s.t. 2 divides s(k)-s(j): (3,2), so a(2)=3.
least (k,j) s.t. 3 divides s(k)-s(j): (3,1), so a(3)=3.
MATHEMATICA
s[n_] := s[n] = Prime[n]; z1 = 400; z2 = 50;
Table[s[n], {n, 1, 30}] (* A000040 *)
u[m_] := u[m] = Flatten[Table[s[k] - s[j],
{k, 2, z1}, {j, 1, k - 1}]][[m]]
Table[u[m], {m, 1, z1}] (* A204890 *)
v[n_, h_] := v[n, h] = If[IntegerQ[u[h]/n], h, 0]
w[n_] := w[n] = Table[v[n, h], {h, 1, z1}]
d[n_] := d[n] = First[Delete[w[n],
Position[w[n], 0]]]
Table[d[n], {n, 1, z2}] (* A204891 *)
k[n_] := k[n] = Floor[(3 + Sqrt[8 d[n] - 1])/2]
m[n_] := m[n] = Floor[(-1 + Sqrt[8 n - 7])/2]
j[n_] := j[n] = d[n] - m[d[n]] (m[d[n]] + 1)/2
Table[k[n], {n, 1, z2}] (* A204892 *)
Table[j[n], {n, 1, z2}] (* A204893 *)
Table[s[k[n]], {n, 1, z2}] (* A204894 *)
Table[s[j[n]], {n, 1, z2}] (* A204895 *)
Table[s[k[n]] - s[j[n]], {n, 1, z2}] (* A204896 *)
Table[(s[k[n]] - s[j[n]])/n, {n, 1, z2}] (* A204897 *)
s = Array[Prime[#] &, 120];
lk = Table[NestWhile[# + 1 &, 1, Min[Table[Mod[s[[#]] - s[[j]], z], {j, 1, # - 1}]] =!= 0 &], {z, 1, Length[s]}]
Table[NestWhile[# + 1 &, 1, Mod[s[[lk[[j]]]] - s[[#]], j] =!= 0 &], {j, 1, Length[lk]}]
(* Peter J. C. Moses, Jan 27 2012 *)
PROG
(PARI) a(n)=forprime(p=n+2, , forstep(k=p%n, p-1, n, if(isprime(k), return(primepi(p))))) \\ Charles R Greathouse IV, Mar 20 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jan 20 2012
STATUS
approved