OFFSET
1,2
COMMENTS
A004648(a(n)) <= 1. - Reinhard Zumkeller, Jul 30 2012
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..94
EXAMPLE
6 is in the sequence because the 6th prime, 13, is congruent to 1 (mod 6).
MATHEMATICA
Do[ If[ IntegerQ[ (Prime[ n ] - 1) / n ], Print[ n ] ], {n, 1, 10^8} ]
PROG
(Haskell)
import Data.List (elemIndices)
a023143 n = a023143_list !! (n-1)
a023143_list = 1 : map (+ 1) (elemIndices 1 a004648_list)
-- Reinhard Zumkeller, Jul 30 2012, Jun 08 2011
(Python)
def A023143(end):
primes=[2, 3]
a023143_list=[1]
num=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(2, len(primes)):
if (primes[x-1]%(x))==1:
a023143_list.append(x)
return a023143_list
# Conner L. Delahanty, Apr 19 2014
(Python)
from sympy import primerange
def A023143(end): return [n+1 for n, p in enumerate(primerange(2, end)) if (p-1) % (n-1) == 0] # David Radcliffe, Jun 27 2016
(PARI) n=0; print1(1); forprime(p=2, 1e9, if(p%n++==1, print1(", "n))) \\ Charles R Greathouse IV, Apr 28 2015
(Magma) [n: n in [1..10000] | IsIntegral((NthPrime(n)-1)/n)]; // Marius A. Burtea, Dec 30 2018
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
David W. Wilson and G. L. Honaker, Jr., Jun 14 1998
EXTENSIONS
More terms from Jud McCranie, Dec 11 1999
a(30)-a(37) from Zak Seidov, Apr 19 2014
Terms a(33)-a(37) sorted in correct order by Giovanni Resta, Feb 23 2020
STATUS
approved