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

A317058 a(n) is the smallest composite k such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k).

Original entry on oeis.org

4, 341, 473, 4, 4, 133, 497, 4, 4, 15, 9, 4, 4, 143, 35, 4, 4, 51, 57, 4, 4, 77, 253, 4, 4, 65, 9, 4, 4, 115, 155, 4, 4, 187, 35, 4, 4, 9, 247, 4, 4, 287, 2051, 4, 4, 15, 33, 4, 4, 35, 85, 4, 4, 9, 9, 4, 4, 551, 1711, 4, 4, 713, 21, 4, 4, 55, 77, 4, 4, 35, 35, 4
Offset: 1

Views

Author

Thomas Ordowski, Jul 26 2018

Keywords

Comments

According to the Agoh-Giuga conjecture, a(n) <> n+1.
a(n) = 4 if and only if n == {0, 1} (mod 4).

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{k = 4}, While[PrimeQ[k] || Mod[Sum[PowerMod[j, k-1, k], {j, n}], k] != Mod[n, k], k++]; k]; Array[a, 72] (* Giovanni Resta, Jul 26 2018 *)
  • PARI
    a(n) = forcomposite(k=1,, if (sum(j=1,n, Mod(j,k)^(k-1)) == n, return (k));); \\ Michel Marcus, Jul 26 2018
    
  • Python
    from sympy import isprime
    def g(n,p,q): # compute (-n + sum_{k=1,n} k^p)  mod q
        c = (-n) % q
        for k in range(1,n+1):
            c = (c+pow(k,p,q)) % q
        return c
    def A317058(n):
        k = 2
        while isprime(k) or g(n,k-1,k):
            k += 1
        return k # Chai Wah Wu, Jul 30 2018

Extensions

More terms from Giovanni Resta, Jul 26 2018

A317358 a(n) is the smallest number k > 1 such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k).

Original entry on oeis.org

2, 3, 5, 2, 2, 7, 11, 2, 2, 3, 3, 2, 2, 17, 17, 2, 2, 3, 3, 2, 2, 23, 29, 2, 2, 5, 3, 2, 2, 31, 37, 2, 2, 37, 35, 2, 2, 3, 41, 2, 2, 43, 47, 2, 2, 3, 3, 2, 2, 5, 5, 2, 2, 3, 3, 2, 2, 59, 61, 2, 2, 67, 3, 2, 2, 55, 71, 2, 2, 35, 35, 2, 2, 3, 5, 2, 2, 5, 5, 2, 2
Offset: 1

Views

Author

Thomas Ordowski, Jul 26 2018

Keywords

Comments

a(n) = 2 if and only if n == {0, 1} (mod 4).
a(n) <= A151800(n).
A133906(n) <= a(n) <= A133907(n).
The sequence is unbounded.
Numbers n such that a(n-1) = n are 2, 3, 7, 23, 31, 43, 59, 139, 283, ...
By the Agoh-Giuga conjecture, if a(n-1) = n, then n is a prime.
It seems that if a(n) > n, then a(n) is a prime (the next prime after n).
If a(n) = n, then n is in A121707. These numbers are 35, 143, 187, 215, ...
Conjecture: all composite terms of the sequence are A121707.

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{k=2}, While[Mod[Sum[PowerMod[j, k-1, k], {j, n}], k] != Mod[n, k], k++]; k]; Array[a, 81] (* Giovanni Resta, Jul 29 2018 *)
  • PARI
    a(n) = for(k=2,oo, if (sum(j=1,n, Mod(j,k)^(k-1)) == n, return (k));); \\ Michel Marcus, Jul 26 2018
    
  • Python
    def g(n,p,q): # compute (-n + sum_{k=1,n} k^p)  mod q
        c = (-n) % q
        for k in range(1,n+1):
            c = (c+pow(k,p,q)) % q
        return c
    def A317358(n):
        k = 2
        while g(n,k-1,k):
            k += 1
        return k # Chai Wah Wu, Jul 30 2018

Extensions

More terms from Michel Marcus, Jul 26 2018

A133907 Least prime number p such that binomial(n+p, p) mod p = 1.

Original entry on oeis.org

2, 3, 5, 2, 2, 7, 11, 2, 2, 3, 3, 2, 2, 17, 17, 2, 2, 3, 3, 2, 2, 23, 29, 2, 2, 5, 3, 2, 2, 31, 37, 2, 2, 37, 37, 2, 2, 3, 41, 2, 2, 43, 47, 2, 2, 3, 3, 2, 2, 5, 5, 2, 2, 3, 3, 2, 2, 59, 61, 2, 2, 67, 3, 2, 2, 67, 71, 2, 2, 71, 73, 2, 2, 3, 5, 2, 2, 5, 5, 2, 2, 3, 3, 2, 2, 89, 89, 2, 2, 3, 3, 2, 2, 97
Offset: 1

Views

Author

Hieronymus Fischer, Oct 20 2007

Keywords

Comments

Also the least prime number p such that p divides floor(n/p) or p > n.
a(n) = 2 if and only if n is in A042948. - Robert Israel, May 11 2017
Conjecture: a(n) is the smallest prime p such that Sum_{k=1..n} k^(p-1) == n (mod p). Thus a(n) >= A317358(n). - Thomas Ordowski, Jul 29 2018

Examples

			a(2)=3, since binomial(2+3,3) mod 3 = 10 mod 3 = 1 and 3 is the minimal prime number with this property.
a(7)=11 because of binomial(7+11, 11) = 31824 = 2893*11 + 1, but binomial(7+k, k) mod k <> 1 for all primes < 11.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local m;
      m:= 2:
      while floor(n/m) mod m <> 0 do m:= nextprime(m) od:
      m
    end proc:
    map(f, [$1..100]); # Robert Israel, May 11 2017
  • Mathematica
    a[n_] := Module[{p}, For[p = 2, True, p = NextPrime[p], If[Mod[Binomial[n+p, p], p] == 1, Return[p]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 05 2023 *)
  • PARI
    a(n) = my(p=2); while (binomial(n+p, p) % p != 1, p = nextprime(p+1)); p; \\ Michel Marcus, Dec 17 2022
    
  • Python
    from sympy import nextprime, ff
    def A133907(n):
        p, m = 2, (n+2)*(n+1)>>1
        while m%p != 1:
            q = nextprime(p)
            m = m*ff(n+q,q-p)//ff(q,q-p)
            p = q
        return p # Chai Wah Wu, Feb 22 2023

A317872 a(n) is the number of times that binomial(n+m, m) mod m = 1, for 0 < m <= n.

Original entry on oeis.org

0, 0, 0, 1, 1, 0, 0, 1, 3, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 3, 2, 0, 0, 1, 2, 2, 4, 4, 4, 0, 0, 3, 4, 1, 1, 3, 3, 1, 0, 1, 1, 2, 2, 1, 2, 1, 1, 2, 4, 2, 2, 4, 4, 6, 4, 3, 2, 2, 2, 1, 1, 0, 1, 7, 6, 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 1, 1, 3, 7, 4, 4, 4, 4, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 3, 3, 3, 4, 5, 5, 2, 2, 3, 1
Offset: 1

Views

Author

Keywords

Comments

Inspired by A133906.
First occurrence of k with k = 0, 1, 2,...: 1, 4, 10, 9, 27, 100, 54, 64, 176, 544, 352, 648, 649, 129, 128, 1378, 513, 729, 7776, 1377, 5832, 1701, 3728, 13312, 13825, ...
Records: 0, 1, 3, 4, 6, 7, 14, 16, 17, 19, 21, 22, ..., ; and they occur at: 1, 4, 9, 27, 54, 64, 128, 513, 729, 1377, 1701, 3728, 6656, ...

Examples

			a(9) = 3 because binomial(9+2,2) mod 2 = binomial(9+3,3) mod 3 = binomial(9+6,6) mod 6 = 1. [Corrected by _Jon E. Schoenfield_, Aug 28 2018]
		

Crossrefs

Cf. A133906.

Programs

  • Mathematica
    a[n_] := Block[{c = 0, m = 1}, While[m < n + 1, If[ Mod[ Binomial[n + m, m], m] == 1, c++]; m++]; c]; Array[a, 105]
    Table[Count[Table[Mod[Binomial[n+m,m],m],{m,n}],1],{n,120}] (* Harvey P. Dale, Aug 18 2022 *)
Showing 1-4 of 4 results.