5 added 89 characters in body
source | link

Java 8, 69 67 62 bytes

n->{int s=0,i=3;form=3;for(;n>0;n/=10)s+=n%10*(i=4-im^=2);return s%10<1;}

-5 bytes thanks to @OlivierGrégoire.
-1 byte thanks to my own 1-year old answer for the Is my barcode valid? challenge, and @OlivierGrégoire to remind me of it.. xD

Try it online.Try it online.

Explanation:

s->{               // Method with long parameter and boolean return-type
  int s=0,         //  Sum, starting at 0
      i=3;m=3;         //  Index-integerMultiplier, starting at 3
  for(;n>0;        //  Loop as long as the input is not 0 yet
      n/=10)       //    After every iteration: integer-divide the input by 10
    s+=            //   Increase the sum by:
      n%10*        //    The last digit of the input multiplied by:
       (i=4-im^=2);     //    `4-i` (either 1 or 3),
                   //    and replace `i` with `4-i` for the(alternating nextevery iteration)
  return s%10<1;}  //  Then return whether the sum is divisible by 10

Java 8, 69 67 62 bytes

n->{int s=0,i=3;for(;n>0;n/=10)s+=n%10*(i=4-i);return s%10<1;}

-5 bytes thanks to @OlivierGrégoire.

Try it online.

Explanation:

s->{               // Method with long parameter and boolean return-type
  int s=0,         //  Sum, starting at 0
      i=3;         //  Index-integer, starting at 3
  for(;n>0;        //  Loop as long as the input is not 0 yet
      n/=10)       //    After every iteration: integer-divide the input by 10
    s+=            //   Increase the sum by:
      n%10*        //    The last digit of the input multiplied by:
       (i=4-i);    //    `4-i` (either 1 or 3),
                   //    and replace `i` with `4-i` for the next iteration
  return s%10<1;}  //  Then return whether the sum is divisible by 10

Java 8, 69 67 62 bytes

n->{int s=0,m=3;for(;n>0;n/=10)s+=n%10*(m^=2);return s%10<1;}

-5 bytes thanks to @OlivierGrégoire.
-1 byte thanks to my own 1-year old answer for the Is my barcode valid? challenge, and @OlivierGrégoire to remind me of it.. xD

Try it online.

Explanation:

s->{               // Method with long parameter and boolean return-type
  int s=0,         //  Sum, starting at 0
      m=3;         //  Multiplier, starting at 3
  for(;n>0;        //  Loop as long as the input is not 0 yet
      n/=10)       //    After every iteration: integer-divide the input by 10
    s+=            //   Increase the sum by:
      n%10*        //    The last digit of the input multiplied by:
       (m^=2);     //    either 1 or 3 (alternating every iteration)
  return s%10<1;}  //  Then return whether the sum is divisible by 10
4 added 16 characters in body
source | link

Java 8, 69 6767 62 bytes

n->{int s=0,i=0;fori=3;for(;n>0;n/=10)s+=n%10*(++i%2*2*+1i=4-i);return s%10>0;s%10<1;}

Try it online.-5 bytes thanks to @OlivierGrégoire.

Try it online.

Explanation:

s->{               // Method with long parameter and boolean return-type
  int s=0,         //  Sum, starting at 0
      i=0;i=3;         //  Index-integer, starting at 03
  for(;n>0;        //  Loop as long as the input is not 0 yet
      n/=10)       //    After every iteration: integer-divide the input by 10
    s+=            //   Increase the sum by:
      n%10*        //    The last digit of the input multiplied by:
       (++i  i=4-i);    //    `4-i` (Increaseeither the1 indexor `i`3),
 by 1 first with `++i`)
        %2*2*+1) //    And then// take the new `i`,and modulo-2,replace multiplied`i` bywith 2,`4-i` increasedfor bythe 1next iteration
  return s%10>0;s%10<1;}  //  Then return whether the sum is NOT divisible by 10

Java 8, 69 67 bytes

n->{int s=0,i=0;for(;n>0;n/=10)s+=n%10*(++i%2*2*+1);return s%10>0;}

Try it online.

Explanation:

s->{             // Method with long parameter and boolean return-type
  int s=0,       //  Sum, starting at 0
      i=0;       //  Index-integer, starting at 0
  for(;n>0;      //  Loop as long as the input is not 0 yet
      n/=10)     //    After every iteration: integer-divide the input by 10
    s+=          //   Increase the sum by:
      n%10*      //    The last digit of the input multiplied by:
       (++i      //    (Increase the index `i` by 1 first with `++i`)
        %2*2*+1) //    And then take the new `i`, modulo-2, multiplied by 2, increased by 1
  return s%10>0;}//  Then return whether the sum is NOT divisible by 10

Java 8, 69 67 62 bytes

n->{int s=0,i=3;for(;n>0;n/=10)s+=n%10*(i=4-i);return s%10<1;}

-5 bytes thanks to @OlivierGrégoire.

Try it online.

Explanation:

s->{               // Method with long parameter and boolean return-type
  int s=0,         //  Sum, starting at 0
      i=3;         //  Index-integer, starting at 3
  for(;n>0;        //  Loop as long as the input is not 0 yet
      n/=10)       //    After every iteration: integer-divide the input by 10
    s+=            //   Increase the sum by:
      n%10*        //    The last digit of the input multiplied by:
       (i=4-i);    //    `4-i` (either 1 or 3),
                   //    and replace `i` with `4-i` for the next iteration
  return s%10<1;}  //  Then return whether the sum is divisible by 10
3 Fixed variable names in explanation..
source | link

Java 8, 69 67 bytes

n->{int s=0,i=0;for(;n>0;n/=10)s+=n%10*(++i%2*2*+1);return s%10>0;}

Try it online.

Explanation:

s->{             // Method with long parameter and boolean return-type
  int x=0s=0,       //  Sum, starting at 0
      i=0;       //  Index-integer, starting at 0
  for(;n>0;      //  Loop as long as the input is not 0 yet
      n/=10)     //    After every iteration: integer-divide the input by 10
    r+=s+=          //   Increase the sum by:
      n%10*      //    The last digit of the input multiplied by:
       (++i      //    (Increase the index `i` by 1 first with `++i`)
        %2*2*+1) //    And then take the new `i`, modulo-2, multiplied by 2, increased by 1
  return r%10>0;s%10>0;}//  Then return whether the sum is NOT divisible by 10

Java 8, 69 67 bytes

n->{int s=0,i=0;for(;n>0;n/=10)s+=n%10*(++i%2*2*+1);return s%10>0;}

Try it online.

Explanation:

s->{             // Method with long parameter and boolean return-type
  int x=0,       //  Sum, starting at 0
      i=0;       //  Index-integer, starting at 0
  for(;n>0;      //  Loop as long as the input is not 0 yet
      n/=10)     //    After every iteration: integer-divide the input by 10
    r+=          //   Increase the sum by:
      n%10*      //    The last digit of the input multiplied by:
       (++i      //    (Increase the index `i` by 1 first with `++i`)
        %2*2*+1) //    And then take the new `i`, modulo-2, multiplied by 2, increased by 1
  return r%10>0;}//  Then return whether the sum is NOT divisible by 10

Java 8, 69 67 bytes

n->{int s=0,i=0;for(;n>0;n/=10)s+=n%10*(++i%2*2*+1);return s%10>0;}

Try it online.

Explanation:

s->{             // Method with long parameter and boolean return-type
  int s=0,       //  Sum, starting at 0
      i=0;       //  Index-integer, starting at 0
  for(;n>0;      //  Loop as long as the input is not 0 yet
      n/=10)     //    After every iteration: integer-divide the input by 10
    s+=          //   Increase the sum by:
      n%10*      //    The last digit of the input multiplied by:
       (++i      //    (Increase the index `i` by 1 first with `++i`)
        %2*2*+1) //    And then take the new `i`, modulo-2, multiplied by 2, increased by 1
  return s%10>0;}//  Then return whether the sum is NOT divisible by 10
2 added 37 characters in body
source | link
1
source | link