login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A221861 The least number k that maximizes k! mod n. 2
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

LINKS

T. D. Noe, Table of n, a(n) for n = 1..10000

EXAMPLE

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.

PROG

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

CROSSREFS

Cf. A062170.

Sequence in context: A123674 A238745 A092607 * A057939 A163371 A061338

Adjacent sequences:  A221858 A221859 A221860 * A221862 A221863 A221864

KEYWORD

nonn

AUTHOR

Aaron Weiner, Apr 10 2013

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 24 03:28 EDT 2019. Contains 325290 sequences. (Running on oeis4.)