OFFSET
0,2
COMMENTS
This is an operation on digit strings: 1066 becomes 201212, for example. 86420 becomes 1612840. The result is always even - see A330336. - N. J. A. Sloane, Dec 17 2019
This sequence is a variant of A124108 in decimal base.
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
FORMULA
a(10*n + d) = 10*a(n) + 2*d for any n >= 0 and d = 0..4.
a(10*n + d) = 100*a(n) + 2*d for any n >= 0 and d = 5..9.
G.f. g(x) satisfies g(x) = (2*x + 4*x^2 + 6*x^3 + 8*x^4 + 10*x^5 + 12*x^6 + 14*x^7 + 16*x^8 + 18*x^9)/(1-x^10) + (10 + 10*x + 10*x^2 + 10*x^3 + 10*x^4 + 100*x^5 + 100*x^6 + 100*x^7 + 100*x^8 + 100*x^9)*g(x^10). - Robert Israel, Nov 28 2018
EXAMPLE
For n = 109:
- we replace "1" with "2", "0" with "0" and "9" with "18",
- hence a(109) = 2018.
MAPLE
f:= proc(n) option remember;
local m, d;
d:= n mod 10; m:= floor(n/10);
if d >= 5 then 100*procname(m) + 2*d
else 10*procname(m)+2*d
fi
end proc:
f(0):= 0:
map(f, [$0..100]); # Robert Israel, Nov 28 2018
MATHEMATICA
a[n_] := FromDigits@Flatten@IntegerDigits[2*IntegerDigits[n]]; Array[a, 60, 0] (* Amiram Eldar, Nov 28 2018 *)
PROG
(PARI) a(n, base=10) = my (d=digits(n, base), v=0); for (i=1, #d, v = v*base^max(1, #digits(2*d[i], base)) + 2*d[i]); v
(Python)
def A322131(n):
return int(''.join(str(int(d)*2) for d in str(n))) # Chai Wah Wu, Nov 29 2018
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Nov 27 2018
STATUS
approved