OFFSET
1,2
LINKS
Conner L. Delahanty, Table of n, a(n) for n = 1..20000
FORMULA
a(n) = (prime(n+1) mod 9) - (prime(n) mod 9).
a(n) = prime(n + 1) - 9*floor((prime(n + 1) - 1)/9) - prime(n) + 9*floor((prime(n) - 1)/9). - Wesley Ivan Hurt, Apr 19 2014
EXAMPLE
For n = 1, (prime(2) mod 9) - (prime(1) mod 9) = 3 (mod 9) - 2 (mod 9) = 3-2 = 1.
For n = 2, (prime(3) mod 9) - (prime(2) mod 9) = 5 (mod 9) - 3 (mod 9) = 5-3 = 2.
For n = 3, (prime(4) mod 9) - (prime(3) mod 9) = 7 (mod 9) - 5 (mod 9) = 7-5 = 2.
For n = 4, (prime(5) mod 9) - (prime(4) mod 9) = 11 (mod 9) - 7 (mod 9) = 2-7 = -5.
MAPLE
A233468:=n->(ithprime(n+1) mod 9) - (ithprime(n) mod 9); seq(A233468(n), n=1..100); # Wesley Ivan Hurt, Apr 19 2014
MATHEMATICA
Table[Mod[Prime[n + 1], 9] - Mod[Prime[n], 9], {n, 100}] (* Wesley Ivan Hurt, Apr 19 2014 *)
PROG
(Python)
dd=[]
def prim(end):
....num=3
....primes=[2, 3]
....while (len(primes)<=end):
........num+=1
........prime=False
........length=len(primes)
........for y in range(0, length):
............if (num % primes[y]!=0):
................prime=True
............else:
................prime=False
................break
........if (prime):
............primes.append(num)
....for x in range(len(primes)-1):
........dd.append((primes[x+1]%9) - (primes[x]%9))
....return dd
CROSSREFS
KEYWORD
base,sign,easy
AUTHOR
Conner L. Delahanty, Apr 18 2014
STATUS
approved