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.

A045550 Numbers whose factorial has '8' as its final nonzero digit.

This page as a plain text file.
%I A045550 #41 Dec 07 2023 16:44:34
%S A045550 9,10,11,13,15,16,18,22,27,30,31,33,39,44,54,57,70,71,73,77,80,81,83,
%T A045550 89,94,102,105,106,108,114,119,125,126,128,137,142,149,154,157,170,
%U A045550 171,173,184,185,186,188,190,191,193,197,204,207,220,221,223
%N A045550 Numbers whose factorial has '8' as its final nonzero digit.
%C A045550 From _Robert Israel_, Dec 16 2016: (Start)
%C A045550 If n is in the sequence, then:
%C A045550 if n == 0 (mod 5), n+1 is in the sequence;
%C A045550 if n == 1 (mod 5), n+1 is in A045549;
%C A045550 if n == 2 (mod 5), n+1 is in A045548;
%C A045550 if n == 3 (mod 5), n+1 is in A045547. (End)
%H A045550 Robert Israel, <a href="/A045550/b045550.txt">Table of n, a(n) for n = 1..10000</a> (n=1..1000 from Harvey P. Dale)
%H A045550 <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>
%p A045550 count:= 0:
%p A045550 r:= 1:
%p A045550 for n from 2 while count < 100 do
%p A045550   r:= r*n;
%p A045550   if r mod 10 = 0 then r:= r/10^padic:-ordp(r, 5) fi;
%p A045550   if r mod 10 = 8 then count:= count+1; A[count]:= n fi;
%p A045550 od:
%p A045550 seq(A[i], i=1..100); # _Robert Israel_, Dec 16 2016
%t A045550 Select[Range[5,250],Last[Flatten[Most[Split[IntegerDigits[#!]]]]]==8&] (* _Harvey P. Dale_, Jun 11 2014 *)
%t A045550 f[n_] := Mod[6 Times @@ (Rest[ FoldList[{1 + #1[[1]], #2! 2^(#1[[1]] #2)} &, {0, 0}, Reverse[ IntegerDigits[n, 5]]]]), 10][[2]] (* after _Jacob A. Siehler_ & _Greg Dresden_ in A008904 *); f[0] = f[1] = 1; Select[ Range[150], f[#] == 8 &] (* _Robert G. Wilson v_, Dec 28 2016 *)
%o A045550 (Python)
%o A045550 from itertools import count, islice
%o A045550 from functools import reduce
%o A045550 from sympy.ntheory.factor_ import digits
%o A045550 def A045550_gen(startvalue=1): # generator of terms >= startvalue
%o A045550     return filter(lambda n:8==reduce(lambda x,y:x*y%10,(((6,2,4,8,6,2,4,8,2,4,8,6,6,2,4,8,4,8,6,2)[(a<<2)|(i*a&3)] if i*a else (1,1,2,6,4)[a]) for i, a in enumerate(digits(n,5)[-1:0:-1])),6), count(max(startvalue,1)))
%o A045550 A045550_list = list(islice(A045550_gen(),30)) # _Chai Wah Wu_, Dec 07 2023
%Y A045550 Cf. A008904, A045547, A045548, A045549.
%K A045550 nonn,base
%O A045550 1,1
%A A045550 _Jeff Burch_