OFFSET
0,3
COMMENTS
a(n) = 0 iff n is in A352535. - Bernard Schott, Jul 08 2022
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
MAPLE
a:= n-> (l-> abs(add(l[i]^2*(-1)^i, i=1..nops(l))))(convert(n, base, 10)):
seq(a(n), n=0..70); # Alois P. Heinz, Mar 24 2022
MATHEMATICA
Array[Abs@ Total@ MapIndexed[(2 Boole@ EvenQ[First[#2]] - 1) (#1^2) &, IntegerDigits[#]] &, 70] (* Michael De Vlieger, Feb 27 2022 *)
PROG
(Haskell)
a257588 = abs . f 1 where
f _ 0 = 0
f s x = s * d ^ 2 + f (negate s) x' where (x', d) = divMod x 10
-- Reinhard Zumkeller, May 10 2015
(Python)
def A257588(n):
return abs(sum((int(d)**2*(-1)**j for j, d in enumerate(str(n)))))
# Chai Wah Wu, May 10 2015
(PARI) a(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^2)); \\ Michel Marcus, Feb 27 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, May 10 2015
STATUS
approved