A076311 a(n) = floor(n/10) - 5*(n mod 10).
0, -5, -10, -15, -20, -25, -30, -35, -40, -45, 1, -4, -9, -14, -19, -24, -29, -34, -39, -44, 2, -3, -8, -13, -18, -23, -28, -33, -38, -43, 3, -2, -7, -12, -17, -22, -27, -32, -37, -42, 4, -1, -6, -11, -16, -21, -26, -31, -36, -41, 5, 0, -5, -10, -15, -20, -25, -30, -35
Offset: 0
Examples
12808 is not a multiple of 17, as 12808 -> 1280-5*8=1240 -> 124-5*0=124 -> 12-5*4=-8=17*(-1)+9, therefore the answer is NO. Is 9248 divisible by 17? 9248 -> 924-5*8=884 -> 88-5*4=68=17*4, therefore the answer is YES.
References
- Karl Menninger, Rechenkniffe, Vandenhoeck & Ruprecht in Goettingen (1961), 79A.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Eric Weisstein's World of Mathematics, Divisibility Tests.
- Wikipedia, Divisibility rule
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,1,-1).
Programs
-
Haskell
a076311 n = n' - 5 * m where (n', m) = divMod n 10 -- Reinhard Zumkeller, Jun 01 2013
-
Magma
[Floor(n/10)-5*(n mod 10): n in [0..50]]; // Vincenzo Librandi, Jun 23 2015
-
Mathematica
Table[Floor[n/10]-5Mod[n,10],{n,0,60}] (* or *) LinearRecurrence[ {1,0,0,0,0,0,0,0,0,1,-1},{0,-5,-10,-15,-20,-25,-30,-35,-40,-45,1},60] (* Harvey P. Dale, Dec 21 2014 *)
-
PARI
a(n)=n\10 - n%10*5 \\ Charles R Greathouse IV, Oct 07 2015
Formula
a(n)= +a(n-1) +a(n-10) -a(n-11). G.f. x *(-5-5*x-5*x^2-5*x^3-5*x^4-5*x^5-5*x^6-5*x^7-5*x^8+46*x^9) / ( (1+x) *(x^4+x^3+x^2+x+1) *(x^4-x^3+x^2-x+1) *(x-1)^2 ). - R. J. Mathar, Feb 20 2011
Comments