cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A257588 If n = abcd... in decimal, a(n) = |a^2 - b^2 + c^2 - d^2 + ...|.

This page as a plain text file.
%I A257588 #25 Jul 11 2022 16:04:43
%S A257588 0,1,4,9,16,25,36,49,64,81,1,0,3,8,15,24,35,48,63,80,4,3,0,5,12,21,32,
%T A257588 45,60,77,9,8,5,0,7,16,27,40,55,72,16,15,12,7,0,9,20,33,48,65,25,24,
%U A257588 21,16,9,0,11,24,39,56,36,35,32,27,20,11,0,13,28,45,49
%N A257588 If n = abcd... in decimal, a(n) = |a^2 - b^2 + c^2 - d^2 + ...|.
%C A257588 a(n) = 0 iff n is in A352535. - _Bernard Schott_, Jul 08 2022
%H A257588 Reinhard Zumkeller, <a href="/A257588/b257588.txt">Table of n, a(n) for n = 0..10000</a>
%p A257588 a:= n-> (l-> abs(add(l[i]^2*(-1)^i, i=1..nops(l))))(convert(n, base, 10)):
%p A257588 seq(a(n), n=0..70);  # _Alois P. Heinz_, Mar 24 2022
%t A257588 Array[Abs@ Total@ MapIndexed[(2 Boole@ EvenQ[First[#2]] - 1) (#1^2) &, IntegerDigits[#]] &, 70] (* _Michael De Vlieger_, Feb 27 2022 *)
%o A257588 (Haskell)
%o A257588 a257588 = abs . f 1 where
%o A257588    f _ 0 = 0
%o A257588    f s x = s * d ^ 2 + f (negate s) x' where (x', d) = divMod x 10
%o A257588 -- _Reinhard Zumkeller_, May 10 2015
%o A257588 (Python)
%o A257588 def A257588(n):
%o A257588     return abs(sum((int(d)**2*(-1)**j for j,d in enumerate(str(n)))))
%o A257588 # _Chai Wah Wu_, May 10 2015
%o A257588 (PARI) a(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^2)); \\ _Michel Marcus_, Feb 27 2022
%Y A257588 Cf. A257587, A257796.
%Y A257588 Cf. A225693, A003132, A352535.
%K A257588 nonn,base
%O A257588 0,3
%A A257588 _N. J. A. Sloane_, May 10 2015