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.

A062169 Triangle T(n, k) = k! mod n for n >= 1, 1 <= k <= n.

Original entry on oeis.org

0, 1, 0, 1, 2, 0, 1, 2, 2, 0, 1, 2, 1, 4, 0, 1, 2, 0, 0, 0, 0, 1, 2, 6, 3, 1, 6, 0, 1, 2, 6, 0, 0, 0, 0, 0, 1, 2, 6, 6, 3, 0, 0, 0, 0, 1, 2, 6, 4, 0, 0, 0, 0, 0, 0, 1, 2, 6, 2, 10, 5, 2, 5, 1, 10, 0, 1, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 6, 11, 3, 5, 9, 7, 11, 6, 1, 12, 0, 1, 2, 6, 10, 8, 6, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Henry Bottomley, Jun 11 2001

Keywords

Examples

			a(7,4) = 4! mod 7 = 24 mod 7 = 3. Rows are:
0;
1,0;
1,2,0;
1,2,2,0;
1,2,1,4,0;
1,2,0,0,0,0;
1,2,6,3,1,6,0;
1,2,6,0,0,0,0,0;
1,2,6,6,3,0,0,0,0;
1,2,6,4,0,0,0,0,0,0;
		

Crossrefs

First zero in each row is when k=A002034. Maximum value in each row is A062170. Number of distinct values in each row is A038203. Cf. A000142, A048158, A051127.

Programs

  • Mathematica
    Table[Mod[Range[n]!, n], {n, 1, 15}] // Flatten (* Jean-François Alcover, Oct 25 2013 *)
  • PARI
    { n=0; for (k=1, 50, for (m=1, k, write("b062169.txt", n++, " ", m!%k)) ) } \\ Harry J. Smith, Aug 02 2009

Extensions

Definition amended by Georg Fischer, Oct 27 2021

A221861 The least number k that maximizes k! mod n.

Original entry on oeis.org

0, 0, 2, 2, 4, 2, 3, 3, 3, 3, 5, 3, 12, 4, 4, 4, 16, 5, 9, 3, 5, 6, 14, 3, 4, 4, 4, 4, 18, 4, 30, 4, 6, 9, 4, 4, 36, 6, 8, 4, 40, 5, 21, 5, 5, 10, 23, 4, 7, 7, 10, 7, 52, 8, 9, 6, 13, 7, 15, 4, 8, 14, 5, 5, 5, 6, 18, 8, 17, 5, 7, 5, 72, 21, 5, 14, 9, 8, 23, 5
Offset: 1

Views

Author

Aaron Weiner, Apr 10 2013

Keywords

Examples

			For n=11, we see that the factorial of 5 (120), modulo 11 is 10, which is the highest possible value, so the 11th term is 5.
		

Crossrefs

Cf. A062170.

Programs

  • Ruby
    (1..100).map{|n|(0..n).max_by{|x|[(1..x).inject(1,:*)%n,-x]}}

A327649 Maximum value of powers of 2 mod n.

Original entry on oeis.org

0, 1, 2, 2, 4, 4, 4, 4, 8, 8, 10, 8, 12, 8, 8, 8, 16, 16, 18, 16, 16, 20, 18, 16, 24, 24, 26, 16, 28, 16, 16, 16, 32, 32, 32, 32, 36, 36, 32, 32, 40, 32, 42, 40, 38, 36, 42, 32, 46, 48, 32, 48, 52, 52, 52, 32, 56, 56, 58, 32, 60, 32, 32, 32, 64, 64, 66, 64, 64
Offset: 1

Views

Author

Rémy Sigrist, Sep 21 2019

Keywords

Examples

			For n = 10:
- the first powers of 2 mod 10 are:
    k   2^k mod 10
    --  ----------
     0           1
     1           2
     2           4
     3           8
     4           6
     5           2
- those values are eventually periodic, the maximum being 8,
- hence a(10) = 8.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local S,k,x,m;
      x:= 1; S:= {1}; m:= 1;
      for k from 1 do
        x:= 2*x mod n;
        if member(x,S) then return m fi;
        S:= S union {x};
        m:= max(m,x)
      od
    end proc:
    f(1):= 0:
    map(f, [$1..100]); # Robert Israel, Feb 15 2023
  • Mathematica
    a[n_] := PowerMod[2, Range[0, n-1], n] // Max;
    Table[a[n], {n, 1, 1000}] (* Jean-François Alcover, May 14 2023 *)
  • PARI
    a(n) = { my (p=1%n, mx=p); while (1, p=(2*p)%n; if (mx
    				

Formula

a(2^k) = 2^(k-1) for any k > 0.
a(2^k+1) = 2^k for any k >= 0.
a(2^k-1) = 2^(k-1) for any k > 1.
If n = 2^j * r with r odd > 1 then a(n) = 2^j * a(r). - Robert Israel, Feb 15 2023

A327663 Maximum value of primorials mod n.

Original entry on oeis.org

0, 1, 2, 2, 2, 2, 6, 6, 6, 6, 8, 6, 9, 6, 6, 14, 15, 12, 18, 10, 9, 12, 15, 18, 20, 22, 24, 14, 23, 6, 30, 30, 30, 32, 30, 30, 30, 30, 30, 30, 35, 30, 38, 34, 30, 38, 44, 42, 42, 40, 42, 30, 51, 48, 45, 42, 48, 52, 58, 30, 60, 50, 42, 62, 35, 30, 62, 66, 48
Offset: 1

Views

Author

Rémy Sigrist, Sep 21 2019

Keywords

Examples

			For n = 8:
- the first primorials mod 8 are:
    k  prime(k)#
    -  ---------
    0          1
    1          2
    2          6
    3          6
    4          2
- the prime numbers > 8 are of the form k + m*8, with m > 0 and k in {1, 3, 5, 7},
- starting from 2, and iteratively multiplying by a number in {1, 3, 5, 7} mod 8, we can only reach 2 or 6, and this value has already been reached before,
- hence a(8) = 6.
		

Crossrefs

Programs

  • PARI
    See Links section.
Showing 1-4 of 4 results.