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-2 of 2 results.

A360805 Nonnegative integers k such that k! mod nextprime(k) is larger than k.

Original entry on oeis.org

0, 31, 120, 283, 293, 712, 2872, 3287, 5028, 5129, 7088, 9553, 13229, 14232, 14799, 15113, 20153, 20830, 23239, 30233, 31430, 31667, 34443, 40654, 44298, 50184, 78877, 105834, 115281, 125120, 164253, 192103, 201590, 227747, 239910, 241910, 282230, 322550, 374370
Offset: 1

Views

Author

Alois P. Heinz, Feb 22 2023

Keywords

Crossrefs

Programs

  • Maple
    q:= n-> is(n! mod nextprime(n)>n):
    select(q, [$0..20000])[];
  • Python
    from itertools import count, islice
    from functools import reduce
    from sympy import nextprime
    def A360805_gen(startvalue=0): # generator of terms >= startvalue
        n = max(startvalue,0)
        m = nextprime(n)
        while True:
            a = m-1
            klist = []
            for i in range(m-1,n,-1):
                a = a*pow(i,-1,m)%m
                if a>i-1:
                    klist.append(i-1)
            yield from sorted(klist)
            n, m = m, nextprime(m)
    A360805_list = list(islice(A360805_gen(),30)) # Chai Wah Wu, Feb 24 2023

Formula

{ k >= 0 : k! mod nextprime(k) > k }.
A360825(a(n)) > a(n).

A375277 a(n) = n! (mod nextprime(n)).

Original entry on oeis.org

1, 1, 2, 1, 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, 66, 39, 1, 78
Offset: 0

Views

Author

Robert G. Wilson v, Sep 18 2024

Keywords

Comments

Same as A360825 except at n=3.
a(n) = 1 iff n+2 is prime (A040976).
a(n) = n iff n+1 is prime (A006093).
a(n) > n iff n is in A360805.

Crossrefs

Cf. A360825 (essentially the same).

Programs

  • Mathematica
    a[n_] := Mod[n!, NextPrime[n]]; Array[a, 79, 0](* for large n *) a[n_] := Block[{m = NextPrime@ n, k = p = 1}, While[k < n +1, p = Mod[p*k, m]; k++]; p]
  • Python
    from functools import reduce
    from sympy import nextprime
    def A375277(n): return ((p:=nextprime(n))-1)*pow(reduce(lambda i, j:i*j%p, range(n+1,p),1),-1,p)%p # Chai Wah Wu, Oct 18 2024
Showing 1-2 of 2 results.