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.

A023143 Numbers k such that prime(k) == 1 (mod k).

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