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 57 results. Next

A072608 Parity of remainder Mod(prime(n),n) = A004648(n).

Original entry on oeis.org

0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
Offset: 1

Views

Author

Labos Elemer, Jun 24 2002

Keywords

Examples

			n=25:p(25)=97,Mod[97,25]=22, a(25)=Mod[22,2]=0. With increasing n, a(n) alternates:...010101..,followed after by a range consisting only of 1-s. This secondary alternation also goes on.
		

Crossrefs

Cf. A004648.

Programs

  • Haskell
    a072608 n = a000040 n `mod` n `mod` 2 -- Reinhard Zumkeller, Dec 16 2013
    
  • Mathematica
    mm[x_] := Mod[Mod[Prime[x], x], 2] Table[mm[w], {w, 1, 256}]
    Table[Mod[Mod[Prime[n],n],2],{n,110}] (* Harvey P. Dale, Apr 22 2016 *)
  • PARI
    a(n)=prime(n)%n%2 \\ Charles R Greathouse IV, Feb 09 2017

Formula

a(n) = Mod(Mod(prime(n), n), 2) = Mod(A004648(n), 2).

A099850 Partial sums of A004648.

Original entry on oeis.org

0, 1, 3, 6, 7, 8, 11, 14, 19, 28, 37, 38, 40, 41, 43, 48, 56, 63, 73, 84, 94, 107, 121, 138, 160, 183, 205, 228, 250, 273, 276, 279, 284, 287, 296, 303, 312, 323, 334, 347, 362, 375, 394, 411, 428, 443, 466, 497, 528, 557, 586, 617, 646, 681, 718, 757, 798, 837
Offset: 1

Views

Author

Mark Hudson (mrmarkhudson(AT)hotmail.com), Oct 27 2004

Keywords

Examples

			A004648 begins: 0, 1, 2, 3, 1, 1, 3, 3, 5, 9, 9, ... so the partial sums are 0, 1, 3, 6, 7, 8, 11, 14, 19, 28, 37, ...
		

Crossrefs

Cf. A004648.

Programs

  • Magma
    [(&+[(NthPrime(k) mod k): k in [1..n]]): n in [1..100]]; // G. C. Greubel, Apr 20 2023
    
  • Mathematica
    Table[Sum[Mod[Prime[j], j], {j,n}], {n,100}] (* G. C. Greubel, Apr 20 2023 *)
    Accumulate[Table[Mod[Prime[n],n],{n,100}]] (* Harvey P. Dale, Jun 14 2023 *)
  • PARI
    s=vector(100):s[1]=prime(1)%1:for(n=2,100,s[n]=s[n-1]+prime(n)%n)
    
  • SageMath
    def A004648(n): return (nth_prime(n)%n)
    def A099850(n): return sum(A004648(k) for k in range(1,n+1))
    [A099850(n) for n in range(1,101)] # G. C. Greubel, Apr 20 2023

Formula

a(n) = Sum_{k=1..n} A004648(k).

A127149 Records in A004648.

Original entry on oeis.org

0, 1, 2, 3, 5, 9, 10, 11, 13, 14, 17, 22, 23, 31, 35, 37, 39, 41, 45, 55, 63, 65, 69, 71, 74, 79, 82, 83, 84, 86, 87, 89, 97, 102, 109, 111, 118, 122, 132, 134, 139, 142, 143, 152, 153, 156, 157, 164, 166, 169, 171, 181, 182, 183, 184, 185, 187, 193, 197, 203, 209, 217, 235, 245
Offset: 1

Views

Author

N. J. A. Sloane, Mar 25 2007

Keywords

Crossrefs

Programs

  • Mathematica
    Module[{r = -1, v}, Table[If[(v = Mod[Prime[k], k]) > r, r = v, Nothing], {k, 500}]] (* Paolo Xausa, Jul 29 2025 *)

A127150 Where records occur in A004648.

Original entry on oeis.org

1, 2, 3, 4, 9, 10, 19, 20, 22, 23, 24, 25, 26, 48, 54, 55, 56, 57, 62, 63, 67, 68, 70, 72, 127, 128, 129, 130, 131, 133, 134, 136, 138, 139, 140, 142, 147, 151, 155, 157, 158, 159, 162, 163, 166, 167, 168, 169, 173, 176, 178, 182, 187, 188, 189, 298, 300, 310, 311, 313, 320
Offset: 1

Views

Author

N. J. A. Sloane, Mar 25 2007

Keywords

Crossrefs

Programs

  • Mathematica
    Module[{r = -1, v}, Table[If[(v = Mod[Prime[k], k]) > r, r = v; k, Nothing], {k, 500}]] (* Paolo Xausa, Jul 29 2025 *)

A247254 a(1)=0; for n>1, a(n+1)= a(n)- A004648(n) if a(n)>= A004648(n) else a(n) + A004648(n).

Original entry on oeis.org

0, 0, 1, 3, 0, 1, 0, 3, 0, 5, 14, 5, 4, 2, 1, 3, 8, 0, 7, 17, 6, 16, 3, 17, 0, 22, 45, 23, 0, 22, 45, 42, 39, 34, 31, 22, 15, 6, 17, 6, 19, 4, 17, 36, 19, 2, 17, 40, 9, 40, 11, 40, 9, 38, 3, 40, 1, 42, 3, 44, 3, 42, 87, 32, 87, 34, 87, 24, 89, 87, 18, 87, 16, 14
Offset: 1

Views

Author

Michel Lagneau, Nov 30 2014

Keywords

Crossrefs

Cf. A004648.

Programs

  • Maple
    A247254 := proc(n)
        option remember;
        local a48 ;
        if n=1 then
            0;
        else
            a48 := A004648(n-1) ;
            if procname(n-1) >= a48 then
                procname(n-1)-a48 ;
            else
                procname(n-1)+a48 ;
            end if;
        end if;
    end proc: # R. J. Mathar, Dec 02 2014

A099641 Number of solutions to x*frac[p(x)/x]<=Log[n] or A004648(n)<=Log[n].

Original entry on oeis.org

1, 5, 6, 12, 13, 14, 15, 31, 32, 34, 69, 73, 74, 75, 76, 77, 181, 445, 1052, 6455, 6456, 6457, 6459, 6460, 6466, 15928, 16055, 40073, 40078, 40080, 40081, 40082, 40083, 40122, 100362, 100364, 100365, 251707, 251711, 251712, 251717, 251719, 251721
Offset: 1

Views

Author

Labos Elemer, Nov 02 2004

Keywords

Comments

Solutions appear in clusters because of features of diagram visible at A004648. Later clusters are introduced by 6455, 15928, 40073, 100362, 251707, 637235, 4124455, respectively.
Number of solutions in consecutive clusters seem to be as follows: 1,2,4,3,6,1,1,1,6,2,7,3 etc..

Crossrefs

Programs

  • Mathematica
    ta={{0}};Do[s=w*fra[Prime[w]/w];If[ !Greater[s, Log[n]], Print[w]; ta=Append[ta, w]], {w, 1, 1000000}];ta=Delete[ta, 1]

A099644 a[n]=Mod[q(n),PrimePi[q(n)]]=Mod[A001359(n), A000720(A001359(n))] where q(n) is the n-th lesser-twin-prime. A004648 restricted to lesser twins.

Original entry on oeis.org

1, 2, 1, 3, 9, 2, 8, 11, 23, 23, 5, 9, 15, 19, 17, 31, 31, 41, 41, 55, 2, 14, 16, 16, 31, 49, 54, 52, 61, 59, 109, 111, 107, 117, 121, 164, 166, 169, 171, 181, 11, 23, 41, 35, 29, 29, 77, 71, 77, 71, 89, 83, 95, 107, 113, 125, 155, 149, 167, 173, 185, 185, 203, 197, 203, 209
Offset: 1

Views

Author

Labos Elemer, Nov 04 2004

Keywords

Comments

Sequence display diagram similar to that of A004648.

Examples

			n=9: p(26)=101 is the 9th lesser-twin-prime,
a(9)-Mod[p(26),26]=Mod[101,26]=23=a(9).
		

Crossrefs

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

A045924 Numbers n such that prime(n) == -1 (mod n).

Original entry on oeis.org

1, 2, 3, 4, 10, 70, 72, 182, 440, 1053, 6458, 6461, 6471, 40087, 40089, 251737, 251742, 637320, 637334, 637336, 1617173, 4124466, 10553445, 10553455, 10553569, 10553570, 10553574, 10553576, 10553819, 10553829, 27067100, 27067262, 69709705, 69709719, 69709734, 69709873
Offset: 1

Views

Author

Keywords

Comments

Same as n such that n divides A008864(n). - David James Sycamore, Jul 23 2018
Also numbers n such that prime(n) == n-1 (mod n). - Muniru A Asiru, Jul 24 2018

Examples

			10 is a member because the 10th prime, 29, is congruent to -1 mod 10.
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[Mod[p = NextPrim[p], n] == n - 1, Print[n]], {n, 1, 10^9}] (* Robert G. Wilson v, Feb 18 2004 *)
  • PARI
    isok(n) = Mod(prime(n), n) == -1; \\ Michel Marcus, Jul 24 2018

Extensions

More terms from Patrick De Geest, Nov 15 1999
Terms a(33) and beyond from Giovanni Resta, Feb 23 2020

A065134 Remainder when n is divided by the number of primes not exceeding n.

Original entry on oeis.org

0, 1, 0, 2, 0, 3, 0, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8, 0, 1, 9, 0, 9, 10, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 5, 6, 7, 8, 9, 10, 8, 9, 7, 8, 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 10, 11, 12, 13, 14, 15, 13, 14, 15, 16, 14, 15, 16, 17, 18, 19, 17, 18, 19
Offset: 2

Views

Author

Labos Elemer, Oct 15 2001

Keywords

Comments

Also remainder when the number of nonprimes is divided by the number of primes (not exceeding n).

Examples

			n = 2: Pi[2] = 1,Mod[1,1] = 0, the first term = a(2) = 0; n = 100: Pi[100] = 25, Mod[100,25] = 0 = a(100); n = 20: Pi[20] = 8, Mod[20,8] = 4 = a(20).
		

Crossrefs

Programs

  • Mathematica
    Table[Last@ QuotientRemainder[n, PrimePi[n]], {n, 2, 91}] (* Michael De Vlieger, Jul 04 2016 *)
  • PARI
    { for (n=2, 1000, write("b065134.txt", n, " ", n%primepi(n)) ) } \\ Harry J. Smith, Oct 11 2009

Formula

a(n) = n (mod pi(n)).

Extensions

Term a(1) removed so OFFSET changed from 1,5 to 2,4 by Harry J. Smith, Oct 11 2009
Since OFFSET is 2,4; Term a(1) removed and a(91) added by Harry J. Smith, Oct 11 2009
Showing 1-10 of 57 results. Next