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.

Previous Showing 31-40 of 71 results. Next

A244797 Number of moduli m such that (prime(n) mod m) = 2.

Original entry on oeis.org

0, 0, 1, 1, 2, 1, 3, 1, 3, 3, 1, 3, 3, 1, 5, 3, 3, 1, 3, 3, 1, 3, 4, 3, 3, 5, 1, 7, 1, 3, 3, 3, 7, 1, 5, 1, 3, 3, 7, 5, 3, 1, 7, 1, 7, 1, 3, 3, 8, 1, 7, 3, 1, 3, 7, 5, 3, 1, 5, 5, 1, 3, 3, 3, 1, 11, 3, 3, 7, 1, 7, 7, 3, 3, 3, 3, 5, 3, 7, 3, 3, 1, 7, 1, 3, 8
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2014

Keywords

Comments

Except for the initial 0,0, this is column 2 of the array at A244740.

Examples

			prime(5) = 11 = (2 mod m) for m = 3, 9 so that a(5) = 2.
		

Crossrefs

Programs

  • Mathematica
    z = 300; f[n_, m_] := If[Mod[Prime[n], m] == 2, 1, 0];
    t = Table[f[n, m], {n, 1, z}, {m, 1, Prime[n]}];
    Table[Count[t[[k]], 1], {k, 1, z}] (* A244797 *)

Formula

a(n) = A032741(A040976(n)). - Ridouane Oudra, Mar 17 2024

A249426 Record values in A249150.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 15, 17, 21, 27, 29, 35, 39, 41, 45, 51, 57, 59, 62, 65, 69, 71, 77, 79, 81, 83, 87, 89, 95, 99, 101, 104, 105, 107, 111, 118, 125, 129, 131, 135, 137, 143, 147, 149, 153, 155, 159, 161, 164, 165, 167, 171, 177, 179, 181, 189, 191, 194, 195, 197, 199, 207, 209, 219, 221, 225, 227, 231, 237, 239, 249, 255
Offset: 1

Views

Author

Antti Karttunen, Oct 28 2014

Keywords

Crossrefs

One less than A249427.
Differs from A040976 a(n) = prime(n) - 2 for the first time at n=19, where a(n) = 62, while A040976(19) = 65. And larger terms differs only a few times.

Programs

Formula

a(n) = A249150(A249425(n)).
a(n) = A249427(n) - 1.

A140777 a(n) = 2*prime(n) - 4.

Original entry on oeis.org

0, 2, 6, 10, 18, 22, 30, 34, 42, 54, 58, 70, 78, 82, 90, 102, 114, 118, 130, 138, 142, 154, 162, 174, 190, 198, 202, 210, 214, 222, 250, 258, 270, 274, 294, 298, 310, 322, 330, 342, 354, 358, 378, 382, 390, 394, 418, 442, 450, 454, 462, 474, 478, 498, 510, 522
Offset: 1

Views

Author

Leroy Quet, May 29 2008, May 31 2008

Keywords

Comments

A number n is included if (p + n/p) is prime, where p is the smallest prime that divides n. Since all terms of this sequence are even (or otherwise p + n/p would be even and not a prime), p is always 2. So this sequence is the set of all even numbers n where (2 + n/2) is prime.
The entries are also encountered via the bilinear transform approximation to the natural log (unit circle). Specifically, evaluating 2(x-1)/(x+1) at x = 2, 3, 4, ..., the terms of this sequence are seen ahead of each new prime encountered. Additionally, the position of those same primes will occur at the entry positions. For clarity, the evaluation output is 2, 3, 1, 1, 6, 5, 4, 3, 10, 7, 3, 2, 14, 9, 8, 5, 18, 11, ..., where the entries ahead of each new prime are 2, 6, 10, 18, ... . As an aside, the same mechanism links this sequence to A165355. - Bill McEachen, Jan 08 2015
As a follow-up to previous comment, it appears that the numerators and denominators of 2(x-1)/(x+1) are respectively given by A145979 and A060819, but with different offsets. - Michel Marcus, Jan 14 2015
Subset of the union of A017641 & A017593. - Michel Marcus, Sep 01 2020

Examples

			The smallest prime dividing 42 is 2. Since 2 + 42/2 = 23 is prime, 42 is included in this sequence.
		

Crossrefs

Programs

  • Magma
    [2*NthPrime(n)-4: n in [1..80]]; // Vincenzo Librandi, Feb 19 2015
  • Maple
    A020639 := proc(n) local dvs,p ; dvs := sort(convert(numtheory[divisors](n),list)) ; for p in dvs do if isprime(p) then RETURN(p) ; fi ; od: error("%d",n) ; end: A111234 := proc(n) local p ; p := A020639(n) ; p+n/p ; end: isA140777 := proc(n) RETURN(isprime(A111234(n))) ; end: for n from 2 to 1200 do if isA140777(n) then printf("%d,",n) ; fi ; od: # R. J. Mathar, May 31 2008
    seq(2*ithprime(i)-4, i=1..1000); # Robert Israel, Jan 09 2015
  • Mathematica
    fQ[n_] := Block[{p = First@ First@ Transpose@ FactorInteger@ n}, PrimeQ[p + n/p] == True]; Select[ Range[2, 533], fQ@# &] (* Robert G. Wilson v, May 30 2008 *)
    Table[2 Prime[n] - 4, {n, 60}] (* Vincenzo Librandi, Feb 19 2015 *)
  • PARI
    vector(100, n, 2*prime(n) - 4) \\ Michel Marcus, Jan 09 2015
    

Formula

a(n) = 2*A040976(n). - Michel Marcus, Jan 09 2015

Extensions

More terms from Robert G. Wilson v and R. J. Mathar, May 30 2008

A215747 a(n) = (-2)^n mod n.

Original entry on oeis.org

0, 0, 1, 0, 3, 4, 5, 0, 1, 4, 9, 4, 11, 4, 7, 0, 15, 10, 17, 16, 13, 4, 21, 16, 18, 4, 1, 16, 27, 4, 29, 0, 25, 4, 17, 28, 35, 4, 31, 16, 39, 22, 41, 16, 28, 4, 45, 16, 19, 24, 43, 16, 51, 28, 12, 32, 49, 4, 57, 16, 59, 4, 55, 0, 33, 64, 65, 16, 61, 44, 69, 64, 71, 4, 7
Offset: 1

Views

Author

Alex Ratushnyak, Aug 23 2012

Keywords

Comments

n^(n+2) mod (n+2) is essentially the same.
Indices of 0's: 2^k - 1, k>=0.
Indices of 1's: A006521 except the first term.
Indices of 3's: A015940.
Indices of 5's: 7, 133, 1517, 11761, ...
a(A000040(n)) = A000040(n)-2 = A040976(n).

Examples

			a(5) = (-2)^5 mod 5 = -32 mod 5 = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (-2)&^n mod n:
    seq(a(n), n=1..100);  # Alois P. Heinz, Apr 08 2015
  • Mathematica
    a[n_]:=Mod[(-2)^n ,n]; Array[a,75] (* Stefano Spezia, Aug 25 2025 *)
  • Python
    for n in range(1, 333):
        print((-2)**n % n, end=',')

A359262 a(n) is the largest number m such that prime(n)^m is in A359260.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 1, 3, 1, 1, 5, 3, 1, 3, 1, 1, 1, 5, 3, 1, 3, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 5, 3, 3, 1, 1, 1, 5, 1, 3, 1, 3, 9, 3, 1, 3, 1, 1, 5, 1, 1, 1, 1, 5, 3, 1, 3, 1, 3, 1, 3, 1, 5, 3, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 3, 1, 9, 1, 3, 3, 1, 1
Offset: 1

Views

Author

Amiram Eldar, Dec 23 2022

Keywords

Comments

a(n) is the largest number m such that the arithmetic mean of {1, p, p^2, ..., p^k} is an integer for all k in 1..m.
Apparently, all the terms are of the form prime(k)-2 (A040976). Conjecture: The asymptotic density of the occurrences of prime(k)-2 is (1/s(k-1)-1/s(k)), where s(k) = A005867(k) = phi(prime(k)#), and prime(k)# is the k-th primorial number (A002110).
The sums of the first 10^k terms, for k = 1, 2, ..., are 15, 221, 2291, 23287, 233641, 2337007, 23379901, 233814475, 2338211029, 23382168187, ... . If the mentioned above conjecture is correct, then the asymptotic mean of this sequence is Sum_{k>=1} (prime(k)-2)*(1/s(k-1)-1/s(k)) = 2.33821872365981424748... .
Apparently, the indices of records after n = 1 occur at A000720(A073917(n)) (verified for the first 12 terms of A073917) with record values a(A000720(A073917(n))) = prime(n+1) - 2 (verified for the first 150 terms of A073917).

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n], k = 1, r = s = 1}, While[Divisible[s, k], k++; r *= p; s += r]; k - 2]; Array[a, 100]
  • PARI
    a(n) = {my(p = prime(n), k = 1, r = s = 1); while(!(s%k), k++; r *= p; s += r); k - 2; }

Formula

a(n) >= 1 for n >= 2.
a(n) >= 3 iff prime(n) == 1 (mod 6) (prime(n) is in A002476).
Conjectures:
a(n) >= 5 iff prime(n) == 1 (mod 30) (prime(n) is in A132230).
a(n) >= 9 iff prime(n) == 1 (mod 210) (prime(n) is in A073102).
a(n) >= prime(k) - 2 iff prime(n) == 1 (mod A002110(k-1)).

A360735 Even integers d such that the longest possible arithmetic progression (AP) of primes with common difference d has only two elements.

Original entry on oeis.org

16, 22, 26, 32, 44, 46, 52, 56, 58, 62, 70, 74, 76, 82, 86, 88, 92, 100, 106, 112, 116, 118, 122, 128, 130, 136, 140, 142, 146, 148, 152, 158, 160, 166, 170, 172, 176, 182, 184, 194, 196, 200, 202, 206, 212, 214, 218, 224, 226, 232, 236, 242, 244, 250, 254, 256, 262, 266, 268
Offset: 1

Views

Author

Bernard Schott, Feb 19 2023

Keywords

Comments

Similar sequence with odd integers d is A040976 \ {0}.
Terms are even numbers that are not divisible by 3 and that are not also in A206037.
These longest corresponding APs are of the form (q, q+d) with q odd primes (see examples).
This subsequence of A359408 corresponds to the second case '2 is one less than prime 3' (see A173919); the first case is linked to A040976.
A342309(d) gives the first element of the smallest such AP with 2 elements whose common difference is a(n) = d.

Examples

			d = 16 is a term because the first longest APs of primes with common difference 16 are (3, 19), (7,23), (13, 29), ... and all have 2 elements because next elements should be respectively 35, 39 and 45 that are all composite; the first such AP that starts with A342309(16) = 3 is (3, 19).
d = 22 is a term because the first longest APs of primes with common difference 22 are (7, 29), (19, 41), (31, 53), ... and all have 2 elements because next elements should be respectively 51, 63 and 75 that are all composite; the first such AP that starts with A342309(22) = 7 is (7, 29).
		

Crossrefs

Programs

  • Maple
    filter := d -> (irem(d, 2) = 0) and (irem(d, 3) <> 0) and not isprime(3+d) or isprime(3+d) and not isprime(3+2*d) : select(filter, [`$`(1 .. 270)]);
    isA360735 := d -> isA047235(d) and not isA206037(d): # Peter Luschny, Mar 03 2023
  • Mathematica
    Select[Range[2, 270, 2], Mod[#, 3] > 0 && Nand @@ PrimeQ[{# + 3, 2*# + 3}] &] (* Amiram Eldar, Mar 03 2023 *)
  • PARI
    isok(d) = !(d%2) && (d%3) && !(isprime(d+3) && isprime(2*d+3)); \\ Michel Marcus, Mar 03 2023

Formula

If m is a term then A123556(m) = 2, but the converse is false: a counterexample is A123556(11) = 2 and 11 is not a term.

A360825 a(n) is the remainder after dividing n! by its least nondivisor.

Original entry on oeis.org

1, 1, 2, 2, 4, 1, 6, 2, 5, 1, 10, 1, 12, 3, 8, 1, 16, 1, 18, 4, 11, 1, 22, 22, 6, 5, 14, 1, 28, 1, 30, 33, 20, 31, 18, 1, 36, 7, 20, 1, 40, 1, 42, 8, 23, 1, 46, 19, 11, 9, 26, 1, 52, 30, 27, 10, 29, 1, 58, 1, 60, 43, 53, 56, 33, 1, 66, 12, 35, 1, 70, 1, 72, 27, 23
Offset: 0

Views

Author

Sebastian F. Orellana, Feb 22 2023

Keywords

Comments

For every term besides a(3), the least nondivisor is the next prime after n.

Examples

			a(5) = 5! mod 7 = 120 mod 7 = 1.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{f = n!, m = n + 1}, While[Divisible[f, m], m++]; Mod[f, m]]; Array[a, 100, 0] (* Amiram Eldar, Feb 22 2023 *)
  • PARI
    a(n) = my(k=1, r); while(!(r=(n! % (n+k))), k++); r; \\ Michel Marcus, Feb 22 2023
    
  • Python
    from functools import reduce
    from sympy import nextprime
    def A360825(n):
        if n == 3: return 2
        m = nextprime(n)
        return reduce(lambda i, j: i*j%m,range(2,n+1),1)%m # Chai Wah Wu, Feb 22 2023
    
  • Python
    from functools import reduce
    from sympy import nextprime
    def A360825(n):
        if n == 3: return 2
        m = nextprime(n)
        return (m-1)*pow(reduce(lambda i,j:i*j%m,range(n+1,m),1),-1,m)%m # Chai Wah Wu, Feb 23 2023

Formula

a(n) = 1 <=> n in { A040976 } \ { 3 }.
a(n) = n <=> n in { A006093 }.
a(n) = n! mod A151800(n) for n > 3.
a(n) = A213636(n!) = A213636(A000142(n)).
a(A000040(n)) = A275111(n) for n >= 3.
a(n) > n <=> n in { A360805 }.

A090321 T(n,k) = prime(n+1) - prime(n-k+1), 1<=k<=n, triangular array read by rows.

Original entry on oeis.org

1, 2, 3, 2, 4, 5, 4, 6, 8, 9, 2, 6, 8, 10, 11, 4, 6, 10, 12, 14, 15, 2, 6, 8, 12, 14, 16, 17, 4, 6, 10, 12, 16, 18, 20, 21, 6, 10, 12, 16, 18, 22, 24, 26, 27, 2, 8, 12, 14, 18, 20, 24, 26, 28, 29, 6, 8, 14, 18, 20, 24, 26, 30, 32, 34, 35, 4, 10, 12, 18, 22, 24, 28, 30, 34, 36, 38
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 26 2004

Keywords

Comments

Row-reversed A086800. - R. J. Mathar, Sep 15 2012

Examples

			1;
2, 3;
2, 4, 5;
4, 6, 8, 9;
2, 6, 8, 10, 11;
4, 6, 10, 12, 14, 15;
		

Crossrefs

Cf. A000040.

Formula

T(n,1) = A001223(n); T(n,n) = A040976(n).

A122585 Reciprocal of n modulo smallest prime greater than n.

Original entry on oeis.org

1, 2, 2, 4, 3, 6, 8, 7, 5, 10, 6, 12, 4, 11, 8, 16, 9, 18, 17, 15, 11, 22, 24, 23, 7, 19, 14, 28, 15, 30, 6, 22, 9, 12, 18, 36, 10, 27, 20, 40, 21, 42, 35, 31, 23, 46, 44, 21, 13, 35, 26, 52, 49, 47, 44, 39, 29, 58, 30, 60, 11, 40, 50, 22, 33, 66, 53, 47, 35, 70, 36, 72, 13, 63, 59
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> n&^(-1) mod nextprime(n):
    seq(a(n), n=1..100);  # Alois P. Heinz, Apr 13 2023
  • Mathematica
    Table[PowerMod[n,-1,NextPrime[n]],{n,80}] (* Harvey P. Dale, Apr 13 2023 *)
  • Python
    from sympy import nextprime
    def A122585(n): return pow(n,-1,nextprime(n)) # Chai Wah Wu, Apr 13 2023

Formula

From Alois P. Heinz, Apr 13 2023: (Start)
a(n) = n <=> n in { A006093 }.
a(n) = (n+1)/2 <=> n in { A040976 } \ { 0 }. (End)

A123317 Smallest prime power m such that n+m is a prime number.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 8, 5, 4, 3, 2, 1, 2, 1, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 32, 5, 4, 3, 2, 1, 8, 5, 4, 3, 2, 1, 2, 1, 256, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 128, 5, 4, 3, 2, 1, 8, 7, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 27 2006

Keywords

Examples

			n=23: 23+1=3*2^3, 23+2=5^2, 23+3=13*2, 23+2^2=3^3, 23+5=7*2^2, 23+7=5*3*2, but 23+8=31=A000040(11), therefore a(23)=8;
n=24: 24+1=5^2, 24+2=13*2, 24+3=3^3, 24+2^2=7*2^2, but 24+5=29=A000040(10), therefore a(24)=5;
the smallest occurring proper odd prime power is 9=3^2:
n=118: 118+1=17*7, 118+2=5*3*2^3, 118+3=11^2, 118+2^2=61*2, 118+5=41*3, 118+7=5^3, 118+2^3=7*2*3^2, but 118+3^2=127=A000040(31), therefore a(118)=9.
		

Crossrefs

Programs

  • Maple
    A123317 := proc(n)
        local m ;
        m :=1 ;
        if isprime(n+m) then
            return m ;
        end if;
        for m from 2 do
            if nops(numtheory[factorset](m)) = 1 then
                if isprime(n+m) then
                    return m;
                end if;
            end if;
        end do:
    end proc:
    seq(A123317(n),n=1..102) ; # R. J. Mathar, Aug 09 2019

Formula

A123318(n) = n + a(n);
a(A006093(n)) = 1; a(A040976(n)) = 2 for n>2.
Previous Showing 31-40 of 71 results. Next