%I #39 Sep 08 2022 08:44:33
%S 0,1,2,3,4,6,7,8,9,10,11,12,14,15,16,17,18,19,20,22,23,24,25,26,27,28,
%T 30,31,32,33,34,35,36,38,39,40,41,42,43,44,46,47,48,49,50,51,52,54,55,
%U 56,57,58,59,60,62,63,64,65,66,67,68,70,71,72,73,74,75,76,78
%N Numbers not congruent to 5 (mod 8).
%C Also, numbers whose binary expansion does not end in 101.
%C Numbers that are congruent to {0, 1, 2, 3, 4, 6, 7} mod 8. - _Wesley Ivan Hurt_, Jul 22 2016
%H Daniel Starodubtsev, <a href="/A004776/b004776.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,0,0,1,-1).
%F Numbers that are congruent to {0, 1, 2, 3, 4, 6, 7} mod 8.
%F G.f.: x^2*(1+x+x^2+x^3+2*x^4+x^5+x^6) / ((x^6+x^5+x^4+x^3+x^2+x+1)*(x-1)^2). - _R. J. Mathar_, Oct 25 2011
%F a(n) = n + floor((n-6)/7). - _M. F. Hasler_, Nov 02 2013
%F From _Wesley Ivan Hurt_, Jul 22 2016: (Start)
%F a(n) = a(n-1) + a(n-7) - a(n-8) for n>8; a(n) = a(n-7) + 8 for n>7.
%F a(n) = (56*n - 63 + (n mod 7) - 6*((n+1) mod 7) + ((n+2) mod 7) + ((n+3) mod 7) + ((n+4) mod 7) + ((n+5) mod 7) + ((n+6) mod 7))/49.
%F a(7k) = 8k-1, a(7k-1) = 8k-2, a(7k-2) = 8k-4, a(7k-3) = 8k-5, a(7k-4) = 8k-6, a(7k-5) = 8k-7, a(7k-6) = 8k-8. (End)
%p A004776:=n->8*floor(n/7)+[0, 1, 2, 3, 4, 6, 7][(n mod 7)+1]: seq(A004776(n), n=0..100); # _Wesley Ivan Hurt_, Jul 22 2016
%t DeleteCases[Range[0,80],_?(Mod[#,8]==5&)] (* _Harvey P. Dale_, Apr 28 2014 *)
%o (Haskell)
%o a004776 n = a004776_list !! (n-1)
%o a004776_list = filter ((/= 5) . (`mod` 8)) [0..]
%o -- _Reinhard Zumkeller_, Aug 17 2012
%o (PARI) is(n)=n%8!=5 \\ _Charles R Greathouse IV_, Mar 07 2013
%o (PARI) A004776(n)=n+(n-6)\7 \\ _M. F. Hasler_, Nov 02 2013
%o (Magma) [n : n in [0..100] | n mod 8 in [0, 1, 2, 3, 4, 6, 7]]; // _Wesley Ivan Hurt_, Jul 22 2016
%Y Cf. A004770 (complement), A045323 (primes).
%K nonn,easy
%O 1,3
%A _N. J. A. Sloane_
%E Edited by _M. F. Hasler_, Nov 02 2013