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.

This page as a plain text file.
%I A004520 #35 Dec 10 2022 01:42:16
%S A004520 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,
%T A004520 42,44,46,48,60,62,64,66,68,60,62,64,66,68,80,82,84,86,88,80,82,84,86,
%U A004520 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
%N A004520 Generalized nim sum n + n in base 10.
%C A004520 a(n) = n + n in carryless arithmetic mod 10. - _N. J. A. Sloane_, Jul 23 2010.
%D A004520 E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982.
%D A004520 J. H. Conway, On Numbers and Games. Academic Press, NY, 1976.
%H A004520 David Applegate, Marc LeBrun and N. J. A. Sloane, <a href="http://neilsloane.com/doc/carry1.pdf">Carryless Arithmetic (I): The Mod 10 Version</a>.
%H A004520 R. Hinze, <a href="https://www.cs.ox.ac.uk/people/ralf.hinze/publications/CSC.pdf">Concrete stream calculus: An extended study</a>, J. Funct. Progr. 20 (5-6) (2010) 463-535, <a href="https://doi.org/10.1017/S0956796810000213">doi</a>, Section 4.4.
%H A004520 <a href="/index/Ca#CARRYLESS">Index entries for sequences related to carryless arithmetic</a>
%H A004520 <a href="/index/Ni#Nimsums">Index entries for sequences related to Nim-sums</a>
%F A004520 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.
%t A004520 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 *)
%o A004520 (Python)
%o A004520 def A004520(n):
%o A004520     return int(''.join(str(2*int(d) % 10) for d in str(n))) # _Chai Wah Wu_, Jun 29 2020
%o A004520 (PARI) a(n) = fromdigits(digits(n)%5)<<1; \\ _Kevin Ryde_, Dec 10 2022
%Y A004520 When sorted and duplicates removed, gives A014263. - _N. J. A. Sloane_, Aug 03 2010
%K A004520 nonn,base,easy
%O A004520 0,2
%A A004520 _N. J. A. Sloane_
%E A004520 More terms from _Robert G. Wilson v_, Aug 23 2010