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!)
A136690 Final nonzero digit of n! in base 3. 16
1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
From David Radcliffe, Sep 03 2021: (Start)
a(n) = (n! / A060828(n)) mod 3;
a(n) = 1 + (A189672(n) mod 2);
a(6*n) = a(6*n+1) = a(2*n);
a(6*n+2) = 3 - a(2*n);
a(6*n+3) = a(6*n+4) = 3 - a(2*n+1);
a(6*n+5) = a(2*n+1).
(End)
a(n) = A008904(A127110(n)). - Michel Marcus, Sep 04 2021
From Kevin Ryde, Dec 03 2022: (Start)
a(n) = 1 if n written in base 9 has an even number of digits {2,3,4,6,7}; and otherwise a(n) = 2.
Fixed point of the morphism 1 -> 1,1,2,2,2,1,2,2,1; 2 -> 2,2,1,1,1,2,1,1,2; starting from 1.
(End)
EXAMPLE
6! = 720 decimal = 222200 ternary, so a(6) = 2.
MATHEMATICA
f[n_] := Mod[6 Times @@ (Rest[ FoldList[{1 + #1[[1]], #2! 2^(#1[[1]] #2)} &, {0, 0}, Reverse[ IntegerDigits[n, 3]]]]), 10][[2]]; # /. {0 -> 1} & /@ Mod[Table[f@n, {n, 0, 104}], 3] (* Robert G. Wilson v, Apr 17 2010 *)
fnzd[n_]:=Module[{sidn3=Split[IntegerDigits[n!, 3]]}, If[MemberQ[ Last[ sidn3], 0], sidn3[[-2, 1]], sidn3[[-1, 1]]]]; Array[fnzd, 110, 0] (* Harvey P. Dale, May 03 2018 *)
PROG
(PARI) a(n) = vecsum([bittest(220, b) |b<-digits(n, 9)])%2 + 1; \\ Kevin Ryde, Dec 03 2022
CROSSREFS
Sequence in context: A238421 A105154 A076447 * A144703 A276825 A270644
KEYWORD
base,easy,nonn
AUTHOR
Carl R. White, Jan 16 2008
EXTENSIONS
More terms from Robert G. Wilson v, Apr 17 2010
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 April 19 06:16 EDT 2024. Contains 371782 sequences. (Running on oeis4.)