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.

A136695 Final nonzero digit of n! in base 8.

Original entry on oeis.org

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

Views

Author

Carl R. White, Jan 16 2008

Keywords

Examples

			6! = 720 decimal = 1320 octal, so a(6) = 2.
		

Crossrefs

Programs

  • 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
  • Mathematica
    Table[IntegerDigits[FromDigits[Reverse[IntegerDigits[n!,8]]]][[1]],{n,0,100}] (* Harvey P. Dale, Nov 29 2024 *)

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)