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.

Showing 1-10 of 12 results. Next

A004648 a(n) = prime(n) mod n.

Original entry on oeis.org

0, 1, 2, 3, 1, 1, 3, 3, 5, 9, 9, 1, 2, 1, 2, 5, 8, 7, 10, 11, 10, 13, 14, 17, 22, 23, 22, 23, 22, 23, 3, 3, 5, 3, 9, 7, 9, 11, 11, 13, 15, 13, 19, 17, 17, 15, 23, 31, 31, 29, 29, 31, 29, 35, 37, 39, 41, 39, 41, 41, 39, 45, 55, 55, 53, 53, 63, 65, 2, 69, 69, 71, 2, 3, 4, 3
Offset: 1

Views

Author

N. J. A. Sloane, Daniel Wild (wild(AT)edumath.u-strasbg.fr)

Keywords

Crossrefs

1's occur at A023143, 2's at A023144, 3's at A023145, 4's at A023146, 5's at A023147, 6's at A023148, 7's at A023149, 8's at A023150, 9's at A023151, 10's at A023152, == -1's at A045924.
For records see A127149, A127150.

Programs

  • Haskell
    a004648 n = a004648_list !! (n-1)
    a004648_list = zipWith mod a000040_list [1..]
    -- Reinhard Zumkeller, Jul 30 2012
    
  • Magma
    [(NthPrime(n) mod n): n in [1..100]]; // Vincenzo Librandi, Apr 06 2011
    
  • Maple
    A004648 := proc(n)
        modp(ithprime(n),n) ;
    end proc: # R. J. Mathar, Dec 02 2014
  • Mathematica
    Table[Mod[Prime[n], n], {n, 100}] (* Zak Seidov, Apr 25 2005 *)
  • PARI
    for(n=1,100,print1(prime(n)%n,","))
    
  • Python
    from sympy import prime; print([prime(i) % i for i in range(1, 101)]) # Jwalin Bhatt, Jul 29 2025
  • SageMath
    def A004648(n): return (nth_prime(n)%n)
    [A004648(n) for n in range(1,101)] # G. C. Greubel, Apr 20 2023
    

Formula

a(n) = prime(n) - n*floor(prime(n)/n)

Extensions

More terms from Clark Kimberling
Corrected by Jaroslav Krizek, Dec 16 2009

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

Original entry on oeis.org

1, 2, 5, 6, 12, 14, 181, 6459, 6460, 6466, 100362, 251712, 251732, 637236, 10553504, 10553505, 10553547, 10553827, 10553851, 10553852, 69709709, 69709724, 69709728, 69709869, 69709961, 69709962, 179992920, 179992922, 179993170, 465769815, 465769819, 465769840, 3140421737, 3140421744, 3140421767, 3140421892, 3140421935
Offset: 1

Views

Author

Keywords

Comments

A004648(a(n)) <= 1. - Reinhard Zumkeller, Jul 30 2012

Examples

			6 is in the sequence because the 6th prime, 13, is congruent to 1 (mod 6).
		

Crossrefs

Programs

  • 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
    
  • Magma
    [n: n in [1..10000] | IsIntegral((NthPrime(n)-1)/n)]; // Marius A. Burtea, Dec 30 2018
  • Mathematica
    Do[ If[ IntegerQ[ (Prime[ n ] - 1) / n ], Print[ n ] ], {n, 1, 10^8} ]
  • PARI
    n=0; print1(1); forprime(p=2,1e9, if(p%n++==1, print1(", "n))) \\ Charles R Greathouse IV, Apr 28 2015
    
  • 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
    

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

A023144 Numbers k such that prime(k) == 2 (mod k).

Original entry on oeis.org

1, 3, 13, 15, 69, 73, 637321, 27066989, 27067095, 27067133, 179992909, 1208198629, 1208198853, 8179002209, 382465573515, 2636913003191, 18262325820323, 18262325820339, 6201265271239163, 6201265271239191, 6201265271239431, 43525513764815041, 43525513764815125
Offset: 1

Views

Author

Keywords

Comments

a(15) > 10^13. - Charles R Greathouse IV, Mar 17 2011

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == 2, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
a(10)-a(13) from Giovanni Resta and Robert G. Wilson v, Feb 22 2006
Missing first term inserted by M. F. Hasler, Feb 04 2009
a(15)-a(23) from Giovanni Resta, Oct 02 2019

A023152 Numbers k such that prime(k) == 10 (mod k).

Original entry on oeis.org

1, 7, 19, 21, 2703, 15929, 4124583, 27067051, 179992913, 179993011, 179993159, 1208198559, 1208198859, 55762149031, 382465573511, 382465573547, 18262325820337, 6201265271239229, 6201265271239409, 6201265271239433, 43525513764814941, 43525513764816369, 43525513764816411, 43525513764816437, 306268030480171419
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == 10, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
  • PARI
    n=0; forprime(p=2,1e9, if(Mod(p,n++)==10, print1(n", "))) \\ Charles R Greathouse IV, Apr 29 2015
  • Sage
    def A023152(max) :
        terms = []
        p = 2
        for n in range(1,max+1) :
            if (p - 10) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013
    

Extensions

Extended by Robert G. Wilson v, Feb 18 2004
a(9)-a(14) from Robert G. Wilson v, Feb 22 2006
First two terms inserted by Eric M. Schmidt, Feb 05 2013
a(15)-a(25) from Giovanni Resta, Feb 23 2020

A023150 Numbers k such that prime(k) == 8 (mod k).

Original entry on oeis.org

1, 3, 17, 443, 2701, 100365, 637235, 637325, 4124455, 4124473, 4124587, 27067125, 27067137, 27067521, 8179002131, 8179002135, 8179002153, 55762149069, 382465573521, 6201265271239145, 6201265271240411, 43525513764814933, 43525513764815131, 43525513764816415
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    p = 1; Do[ If[ Mod[p = NextPrime[p], n] == 8, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
  • Sage
    def A023150(max):
        terms = []
        p = 2
        for n in range(1, max+1) :
            if (p - 8) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
a(15)-a(18) from Robert G. Wilson v, Feb 22 2006
First two terms inserted by Eric M. Schmidt, Feb 05 2013
Terms a(19) and beyond from Giovanni Resta, Feb 23 2020

A023145 Numbers k such that prime(k) == 3 (mod k).

Original entry on oeis.org

1, 2, 4, 7, 8, 31, 32, 34, 74, 76, 1052, 6455, 15928, 251707, 251765, 4124458, 27067012, 27067120, 69709718, 69709871, 69709877, 69709934, 69709943, 69709954, 69709963, 69709964, 465769810, 8179002124, 145935689390, 382465573486, 885992692751818, 885992692751822
Offset: 1

Views

Author

Keywords

Examples

			204475053103 = prime(8179002124) and 204475053103 = 25*8179002124 + 3.
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == 3, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
    Select[Range[100000], Mod[Prime[#] - 3, #] == 0 &] (* T. D. Noe, Feb 05 2013 *)
  • Sage
    def A023145(max) :
        terms = []
        p = 2
        for n in range(1, max+1) :
            if (p - 3) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
2 more terms from Giovanni Resta, Feb 22 2006
a(29) from Robert G. Wilson v, Feb 22 2006
First two terms inserted by Eric M. Schmidt, Feb 05 2013
Terms a(30) and beyond from Giovanni Resta, Feb 23 2020

A023146 Numbers k such that prime(k) == 4 (mod k).

Original entry on oeis.org

1, 75, 77, 637331, 637333, 637341, 637343, 27067053, 179992917, 8179002205, 2636913002917, 6201265271239157, 6201265271239347, 6201265271239413, 6201265271239981, 6201265271240331, 6201265271240341, 2159986889494445405, 2159986889494445525, 2159986889494445615
Offset: 1

Views

Author

Keywords

Examples

			The 75th prime is 379 and 379 == 4 (mod 75). Hence 75 is in the sequence.
The 76th prime is 383, but 383 == 3, not 4, (mod 76). So 76 is not in the sequence.
		

Crossrefs

Programs

  • Mathematica
    nextPrime[n_] := Block[{k = n + 1}, While[!PrimeQ[k], k++]; k]; p = 1; Do[If[Mod[p = nextPrime[p], n] == 4, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
    Select[Range[1000], Mod[Prime[#], #] == 4 &] (* Alonso del Arte, Nov 16 2018 *)
  • Sage
    def A023146(max) :
        terms = []
        p = 2
        for n in range(1, max+1) :
            if (p - 4) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
2 more terms from Giovanni Resta and Robert G. Wilson v, Feb 22 2006
First term inserted by Eric M. Schmidt, Feb 05 2013
a(11)-a(20) from Giovanni Resta, Feb 23 2020

A023147 Numbers k such that prime(k) == 5 (mod k).

Original entry on oeis.org

1, 2, 3, 9, 16, 33, 40073, 40078, 40082, 40083, 40122, 251721, 251722, 251734, 251736, 4124584, 10553433, 10553439, 10553444, 10553454, 10553478, 10553552, 10553553, 10553818, 27067098, 27067524, 179992912, 465769814, 465769832, 465769839
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    p = 1; Do[ If[ Mod[p = NextPrime[p], n] == 5, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
a(24)-a(27) from Robert G. Wilson v, Feb 18 2004
Three missing initial terms at start of sequence inserted by Zak Seidov, Feb 05 2009

A023148 Numbers k such that prime(k) == 6 (mod k).

Original entry on oeis.org

1, 5, 79, 445, 16055, 27067045, 1208198549, 1208198609, 1208198615, 2636913002983, 885992692751479, 885992692751483, 885992692751833, 43525513764815035, 43525513764815057, 43525513764815173, 43525513764816367
Offset: 1

Views

Author

Keywords

Comments

a(18) > 2.8*10^20. - Giovanni Resta, Feb 23 2020

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == 6, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
  • Sage
    def A023148(max) :
        terms = []
        p = 2
        for n in range(1, max+1) :
            if (p - 6) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013

Extensions

Extended by Robert G. Wilson v, Feb 18 2004
a(7)-a(9) from Robert G. Wilson v, Feb 22 2006
First two terms inserted by Eric M. Schmidt, Feb 05 2013
a(10)-a(17) from Giovanni Resta, Feb 23 2020

A023151 Numbers k such that prime(k) == 9 (mod k).

Original entry on oeis.org

1, 2, 10, 11, 35, 37, 80, 100364, 251711, 251717, 251731, 251735, 251741, 251770, 4124456, 4124582, 27067096, 27067520, 69709706, 69709717, 69709723, 69709868, 69709931, 69709933, 465769825, 465769826, 465769831, 1208198548, 8179002130
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == 9, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
  • Sage
    def A023151(max) :
        terms = []
        p = 2
        for n in range(1, max+1) :
            if (p - 9) % n == 0 : terms.append(n)
            p = next_prime(p)
        return terms
    # Eric M. Schmidt, Feb 05 2013

Extensions

More terms from Robert G. Wilson v, Feb 18 2004
a(25)-a(29) from Robert G. Wilson v, Feb 22 2006
First two terms inserted by Eric M. Schmidt, Feb 05 2013
Showing 1-10 of 12 results. Next