Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #20 Jul 13 2020 04:52:44
%S 1,5,25,125,625,3125,15625,8125,40625,203125,1015625,508125,2540625,
%T 1203125,6015625,3008125,15040625,5203125,26015625,13008125,65040625,
%U 325203125,1626015625,813008125,4065040625,20325203125,101626015625,50813008125,254065040625
%N Start with a(0) = 1; thereafter a(n) is obtained from 5*a(n-1) by removing all 7's.
%C This sequence is a rare non-periodic case of the recurrence where x(0)=1 and x(n+1) is obtained from m*x(n) by removing all digits k and all trailing zeros in base b. In fact, except for (m, b, k) = (5, 10, 7) (this sequence), x is eventually periodic whenever m <= 5 and 2 <= b <= 32, or m <= 16 and 2 <= b <= 16. However, for negative b it seems that x is non-periodic more frequently, for example when (m, b, k) is (2, -5, 1) or (2, -8, 1).
%H <a href="/index/Rec#order_20">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,100000,0,0,0,-100000).
%F a(n) = a(n-4) + 100000*(a(n-16) - a(n-20)) for n > 22.
%F Recurrence (for n > 2):
%F a(n+1) = 5*a(n) if n is 1, 3, 4, 5, 7, 8, 9, 11, 13, or 15 mod 16 (these are the cases where 5*a(n) doesn't contain any 7's);
%F a(n+1) = (a(n) + 625)/2 if n is 2, 6, 10, or 14 mod 16;
%F a(n+1) = 5*a(n) - 7*10^(5*n/16 + 2) if n is 0 mod 16;
%F a(n+1) = 5*a(n) - 115*10^(5*(n + 4)/16) if n is 12 mod 16.
%F Explicit expressions:
%F a(16*n) = (37*2^4*10^(5*n - 2) - 1)*5^5/123 for n >= 1;
%F a(16*n + 1) = (2^12*10^(5*n - 4) - 1)*5^6/123 for n >= 1;
%F a(16*n + 2) = (2^12*10^(5*n - 4) - 1)*5^7/123 for n >= 1;
%F a(16*n + 3) = (2^8*10^(5*n - 1) - 1)*5^4/123 for n >= 0;
%F a(16*n + 4) = (2^8*10^(5*n - 1) - 1)*5^5/123 for n >= 0;
%F a(16*n + 5) = (2^8*10^(5*n - 1) - 1)*5^6/123 for n >= 0;
%F a(16*n + 6) = (2^8*10^(5*n - 1) - 1)*5^7/123 for n >= 0;
%F a(16*n + 7) = (2^4*10^(5*n + 2) - 1)*5^4/123 for n >= 0;
%F a(16*n + 8) = (2^4*10^(5*n + 2) - 1)*5^5/123 for n >= 0;
%F a(16*n + 9) = (2^4*10^(5*n + 2) - 1)*5^6/123 for n >= 0;
%F a(16*n + 10) = (2^4*10^(5*n + 2) - 1)*5^7/123 for n >= 0;
%F a(16*n + 11) = (10^(5*n + 5) - 1)*5^4/123 for n >= 0;
%F a(16*n + 12) = (10^(5*n + 5) - 1)*5^5/123 for n >= 0;
%F a(16*n + 13) = (37*2^8*10^(5*n) - 1)*5^6/123 for n >= 0;
%F a(16*n + 14) = (37*2^8*10^(5*n) - 1)*5^7/123 for n >= 0;
%F a(16*n + 15) = (37*2^4*10^(5*n + 3) - 1)*5^4/123 for n >= 0.
%e For n <= 6, no 7's occur in 5^n, so a(n) = 5^n. Deleting the 7 in 5*a(6) = 78125, we obtain a(7) = 8125.
%t Remove7[n_] := FromDigits[Select[IntegerDigits[n], # != 7 &]]; a[0] = 1; a[n_] := a[n] = Remove7[5 * a[n - 1]]; Array[a, 29, 0] (* _Amiram Eldar_, Jun 20 2020 *)
%o (Python)
%o from sympy.ntheory.factor_ import digits
%o from functools import reduce
%o def drop(x,n,k):
%o # Drop all digits k from x in base n.
%o return reduce(lambda x,j:n*x+j if j!=k else x,digits(x, n)[1:],0)
%o def A335506(n):
%o if n==0:
%o return 1
%o else:
%o return drop(5*A335506(n-1),10,7)
%Y Cf. A335505.
%K nonn,base
%O 0,2
%A _Pontus von Brömssen_, Jun 13 2020