%I #65 Aug 14 2022 15:27:08
%S 1,2,5,6,12,14,181,6459,6460,6466,100362,251712,251732,637236,
%T 10553504,10553505,10553547,10553827,10553851,10553852,69709709,
%U 69709724,69709728,69709869,69709961,69709962,179992920,179992922,179993170,465769815,465769819,465769840,3140421737,3140421744,3140421767,3140421892,3140421935
%N Numbers k such that prime(k) == 1 (mod k).
%C A004648(a(n)) <= 1. - _Reinhard Zumkeller_, Jul 30 2012
%H Giovanni Resta, <a href="/A023143/b023143.txt">Table of n, a(n) for n = 1..94</a>
%e 6 is in the sequence because the 6th prime, 13, is congruent to 1 (mod 6).
%t Do[ If[ IntegerQ[ (Prime[ n ] - 1) / n ], Print[ n ] ], {n, 1, 10^8} ]
%o (Haskell)
%o import Data.List (elemIndices)
%o a023143 n = a023143_list !! (n-1)
%o a023143_list = 1 : map (+ 1) (elemIndices 1 a004648_list)
%o -- _Reinhard Zumkeller_, Jul 30 2012, Jun 08 2011
%o (Python)
%o def A023143(end):
%o primes=[2,3]
%o a023143_list=[1]
%o num=3
%o while len(primes)<=end:
%o num+=1
%o prime=False
%o length=len(primes)
%o for y in range(0,length):
%o if num % primes[y]!=0:
%o prime=True
%o else:
%o prime=False
%o break
%o if (prime):
%o primes.append(num)
%o for x in range(2, len(primes)):
%o if (primes[x-1]%(x))==1:
%o a023143_list.append(x)
%o return a023143_list
%o # _Conner L. Delahanty_, Apr 19 2014
%o (Python)
%o from sympy import primerange
%o 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
%o (PARI) n=0; print1(1); forprime(p=2,1e9, if(p%n++==1, print1(", "n))) \\ _Charles R Greathouse IV_, Apr 28 2015
%o (Magma) [n: n in [1..10000] | IsIntegral((NthPrime(n)-1)/n)]; // _Marius A. Burtea_, Dec 30 2018
%Y Cf. A048891, A045924, A052013, A023144, A023145, A023146, A023147, A023148, A023149, A023150, A023151, A023152.
%K nonn,nice
%O 1,2
%A _David W. Wilson_ and _G. L. Honaker, Jr._, Jun 14 1998
%E More terms from _Jud McCranie_, Dec 11 1999
%E a(30)-a(37) from _Zak Seidov_, Apr 19 2014
%E Terms a(33)-a(37) sorted in correct order by _Giovanni Resta_, Feb 23 2020
|