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.

A004520 Generalized nim sum n + n in base 10.

Original entry on oeis.org

0, 2, 4, 6, 8, 0, 2, 4, 6, 8, 20, 22, 24, 26, 28, 20, 22, 24, 26, 28, 40, 42, 44, 46, 48, 40, 42, 44, 46, 48, 60, 62, 64, 66, 68, 60, 62, 64, 66, 68, 80, 82, 84, 86, 88, 80, 82, 84, 86, 88, 0, 2, 4, 6, 8, 0, 2, 4, 6, 8, 20, 22, 24, 26, 28, 20, 22, 24, 26, 28, 40, 42, 44, 46, 48, 40, 42
Offset: 0

Views

Author

Keywords

Comments

a(n) = n + n in carryless arithmetic mod 10. - N. J. A. Sloane, Jul 23 2010.

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976.

Crossrefs

When sorted and duplicates removed, gives A014263. - N. J. A. Sloane, Aug 03 2010

Programs

  • Mathematica
    carrylessAdd[m_, n_, b_] := Block[{lm = IntegerLength[m, b], ln = IntegerLength[n, b]}, mx = Max[lm, ln]; idm = IntegerDigits[m, b, mx]; idn = IntegerDigits[n, b, mx]; FromDigits[ Mod[ idm + idn, b], b]]; Table[ carrylessAdd[n, n, 10], {n, 0, 76}] (* Robert G. Wilson v, Aug 23 2010 *)
  • PARI
    a(n) = fromdigits(digits(n)%5)<<1; \\ Kevin Ryde, Dec 10 2022
  • Python
    def A004520(n):
        return int(''.join(str(2*int(d) % 10) for d in str(n))) # Chai Wah Wu, Jun 29 2020
    

Formula

Generalized nim sum m + n in base q: write m and n in base q and add mod q with no carries, e.g. 5 + 8 in base 3 = "21" + "22" = "10" = 1.

Extensions

More terms from Robert G. Wilson v, Aug 23 2010