login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A327650 Maximum value of powers of 3 mod n. 2
0, 1, 1, 3, 4, 3, 6, 3, 3, 9, 9, 9, 9, 13, 12, 11, 16, 9, 18, 9, 18, 15, 18, 9, 24, 9, 9, 27, 28, 27, 30, 27, 27, 33, 33, 27, 36, 37, 27, 27, 40, 39, 42, 37, 36, 41, 42, 33, 48, 49, 48, 35, 52, 27, 53, 27, 54, 57, 57, 27, 60, 61, 54, 59, 61, 45, 66, 63, 54, 51 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
LINKS
Rémy Sigrist, Colored scatterplot of the ordinal transform of the first 3^10 terms (colored pixels correspond to n's such that a(n) is a power of 3)
FORMULA
a(3^k) = 3^(k-1) for any k > 0.
a(3^k + 1) = 3^k for any k >= 0.
a(3^k - 1) = 3^(k-1) for any k > 0.
EXAMPLE
For n = 12:
- the first powers of 3 mod 12 are:
k 3^k mod 12
-- ----------
0 1
1 3
2 9
3 3
- those values are eventually periodic, the maximum being 9,
- hence a(12) = 9.
MATHEMATICA
a[n_] := PowerMod[3, Range[0, n-1], n] // Max;
Table[a[n], {n, 1, 1000}] (* Jean-François Alcover, May 14 2023 *)
PROG
(PARI) a(n) = { my (p=1%n, mx=p); while (1, p=(3*p)%n; if (mx<p, mx=p, mx==p || p==0, return (mx))) }
CROSSREFS
Sequence in context: A238161 A332880 A281626 * A338128 A242801 A021295
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Sep 21 2019
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 11 02:40 EDT 2024. Contains 372388 sequences. (Running on oeis4.)