login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A257587 If n = abcd... in decimal, a(n) = a^2 - b^2 + c^2 - d^2 + ... 3

%I #28 Mar 11 2024 04:42:54

%S 0,1,4,9,16,25,36,49,64,81,1,0,-3,-8,-15,-24,-35,-48,-63,-80,4,3,0,-5,

%T -12,-21,-32,-45,-60,-77,9,8,5,0,-7,-16,-27,-40,-55,-72,16,15,12,7,0,

%U -9,-20,-33,-48,-65,25,24,21,16,9,0,-11,-24,-39,-56,36,35,32

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

%H Michel Marcus, <a href="/A257587/b257587.txt">Table of n, a(n) for n = 0..10000</a>

%F a(A352535(n)) = 0. - _Bernard Schott_, Jul 12 2022

%t A257587[n_] := Total[-(-1)^Range[Max[IntegerLength[n], 1]]*IntegerDigits[n]^2];

%t Array[A257587, 100, 0] (* _Paolo Xausa_, Mar 11 2024 *)

%o (Python)

%o def a(n): return sum(int(d)**2*(-1)**i for i, d in enumerate(str(n)))

%o print([a(n) for n in range(63)]) # _Michael S. Branicky_, Jul 11 2022

%o (PARI) a(n) = my(d=digits(n)); sum(k=1, #d, (-1)^(k+1)*d[k]^2); \\ _Michel Marcus_, Jul 12 2022

%Y First 100 terms coincide with those of A177894, but then they diverge.

%Y Cf. A257588, A257796, A352535 (indices of zeros).

%K sign,base

%O 0,3

%A _N. J. A. Sloane_, May 10 2015

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 00:02 EDT 2024. Contains 372317 sequences. (Running on oeis4.)