OFFSET
0,2
COMMENTS
Inspired by Luhn algorithm for validating credit cards.
FORMULA
a(n) = sum of digits(if even n then n else 2n).
EXAMPLE
a(11) = 4 = 2 + 2 (2 and 2 are the digits in 22 = 2 * 11).
a(12) = 3 = 1 + 2 (1 and 2 are the digits in 12).
MATHEMATICA
f[n_] := Plus @@ IntegerDigits[ If[ EvenQ[n], n, 2n]]; Table[ f[n], {n, 0, 90}] (* Robert G. Wilson v, Mar 24 2004 *)
Table[If[EvenQ[n], Total[IntegerDigits[n]], Total[IntegerDigits[2n]]], {n, 0, 120}] (* Harvey P. Dale, Mar 18 2019 *)
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Semaphore Corporation (help(AT)semaphorecorp.com), Mar 20 2004
EXTENSIONS
Corrected and extended by Ray Chandler, Mar 21 2004
STATUS
approved