[go: up one dir, main page]

login
A136695
Final nonzero digit of n! in base 8.
16
1, 1, 2, 6, 3, 7, 2, 6, 6, 6, 4, 4, 6, 6, 4, 4, 3, 3, 6, 2, 5, 1, 6, 2, 6, 6, 4, 4, 6, 6, 4, 4, 6, 6, 4, 4, 2, 2, 4, 4, 4, 4, 1, 3, 4, 4, 3, 5, 6, 6, 4, 4, 2, 2, 4, 4, 4, 4, 3, 1, 4, 4, 5, 3, 3, 3, 6, 2, 1, 5, 6, 2, 2, 2, 4, 4, 2, 2, 4, 4, 5, 5, 2, 6, 3, 7, 2, 6, 2, 2, 4, 4, 2, 2, 4, 4, 6, 6, 4, 4
OFFSET
0,3
LINKS
FORMULA
From Robert Israel, Sep 26 2018: (Start)
If A011371(n) == 0 (mod 3) then a(n) = A049606(n) mod 8.
If A011371(n) == 1 (mod 3) then a(n) = 2*(A049606(n) mod 4).
If A011371(n) == 2 (mod 3) then a(n) = 4. (End)
EXAMPLE
6! = 720 decimal = 1320 octal, so a(6) = 2.
MAPLE
P:= 1: E:= 0: a[0]:= 1:
for n from 1 to 100 do
v:= padic:-ordp(n, 2);
P:= P*(n/2^v) mod 8;
E:= E + v;
if E mod 3 = 0 then a[n]:= P
elif E mod 3 = 1 then a[n]:= 2*(P mod 4)
else a[n]:= 4
fi
od:
seq(a[n], n=0..100); # Robert Israel, Sep 26 2018
KEYWORD
base,easy,nonn
AUTHOR
Carl R. White, Jan 16 2008
STATUS
approved