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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

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, 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, 21, 16, 9, 0, 11, 24, 39, 56, 36, 35, 32, 27, 20, 11, 0, 13, 28, 45, 49
Offset: 0

Views

Author

N. J. A. Sloane, May 10 2015

Keywords

Comments

a(n) = 0 iff n is in A352535. - Bernard Schott, Jul 08 2022

Crossrefs

Programs

  • 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
    
  • 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 *)
  • PARI
    a(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^2)); \\ Michel Marcus, Feb 27 2022
  • 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
    

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

Original entry on oeis.org

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, -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, 21, 16, 9, 0, -11, -24, -39, -56, 36, 35, 32
Offset: 0

Views

Author

N. J. A. Sloane, May 10 2015

Keywords

Crossrefs

First 100 terms coincide with those of A177894, but then they diverge.
Cf. A257588, A257796, A352535 (indices of zeros).

Programs

  • Mathematica
    A257587[n_] := Total[-(-1)^Range[Max[IntegerLength[n], 1]]*IntegerDigits[n]^2];
    Array[A257587, 100, 0] (* Paolo Xausa, Mar 11 2024 *)
  • PARI
    a(n) = my(d=digits(n)); sum(k=1, #d, (-1)^(k+1)*d[k]^2); \\ Michel Marcus, Jul 12 2022
  • Python
    def a(n): return sum(int(d)**2*(-1)**i for i, d in enumerate(str(n)))
    print([a(n) for n in range(63)]) # Michael S. Branicky, Jul 11 2022
    

Formula

a(A352535(n)) = 0. - Bernard Schott, Jul 12 2022
Showing 1-2 of 2 results.