login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A093017 Luhn algorithm double-and-add sum of digits of n. 16
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, 8, 9, 10, 11, 12, 13 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

Starting on the right, sum digits after doubling alternating digits beginning with the second. If doubled digit >9, reduce by 9 (sum of digits).

a(n) = A007953(A249873(n); A093019(n) = 10 - a(10*n) mod 10 if less than 10, otherwise 0. - Reinhard Zumkeller, Nov 08 2014

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

John Kilgo, DotNetJohn.com, Using the Luhn Algorithm

Webopedia, Luhn formula

Wikipedia, Luhn algorithm

Index entries for sequences related to decimal expansion of n

EXAMPLE

a(18) = 2*1 + 8 = 10.

a(59) = (1+0) + 9 = 10 (1 and 0 are the digits in 10 = 2*5).

PROG

(Haskell)

a093017 n = if n == 0 then 0 else a093017 n' + a007953 (2 * t) + d

            where (n', td) = divMod n 100; (t, d) = divMod td 10

-- Reinhard Zumkeller, Nov 08 2014

CROSSREFS

Cf. A093018-A093029.

Cf. A007953, A093019.

Sequence in context: A189506 A173529 A273005 * A156230 A028897 A244158

Adjacent sequences:  A093014 A093015 A093016 * A093018 A093019 A093020

KEYWORD

easy,nonn,base

AUTHOR

Ray Chandler, Apr 03 2004

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 21 16:42 EDT 2021. Contains 345365 sequences. (Running on oeis4.)