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-10 of 26 results. Next

A000695 Moser-de Bruijn sequence: sums of distinct powers of 4.

Original entry on oeis.org

0, 1, 4, 5, 16, 17, 20, 21, 64, 65, 68, 69, 80, 81, 84, 85, 256, 257, 260, 261, 272, 273, 276, 277, 320, 321, 324, 325, 336, 337, 340, 341, 1024, 1025, 1028, 1029, 1040, 1041, 1044, 1045, 1088, 1089, 1092, 1093, 1104, 1105, 1108, 1109, 1280, 1281, 1284, 1285
Offset: 0

Views

Author

Keywords

Comments

Although this is a list, it has offset 0 for both historical and mathematical reasons.
Numbers whose set of base-4 digits is a subset of {0,1}. - Ray Chandler, Aug 03 2004, corrected by M. F. Hasler, Oct 16 2018
Numbers k such that the sum of the base-2 digits of k = sum of the base-4 digits of k. - Clark Kimberling
Numbers having the same representation in both binary and negabinary (A039724). - Eric W. Weisstein
This sequence has many other interesting and useful properties. Every term k corresponds to a unique pair i,j with k = a(i) + 2*a(j) (i=A059905(n), j=A059906(n)) -- see A126684. Every list of numbers L = [L1,L2,L3,...] can be encoded uniquely by "recursive binary interleaving", where f(L) = a(L1) + 2*a(f([L2,L3,...])) with f([])=0. - Marc LeBrun, Feb 07 2001
This may be described concisely using the "rebase" notation b[n]q, which means "replace b with q in the expansion of n", thus "rebasing" n from base b into base q. The present sequence is 2[n]4. Many interesting operations (e.g., 10[n](1/10) = digit reverse, shifted) are nicely expressible this way. Note that q[n]b is (roughly) inverse to b[n]q. It's also natural to generalize the idea of "basis" so as to cover the likes of F[n]2, the so-called "fibbinary" numbers (A003714) and provide standard ready-made images of entities obeying other arithmetics, say like GF2[n]2 (e.g., primes = A014580, squares = the present sequence, etc.). - Marc LeBrun, Mar 24 2005
a(n) is also equal to the product n X n formed using carryless binary multiplication (A059729, A063010). - Henry Bottomley, Jul 03 2001
Numbers k such that A004117(k) is odd. - Pontus von Brömssen, Nov 25 2008
Fixed point of the morphism: 0 -> 01; 1 -> 45; 2 -> 89; ...; n -> (4n)(4n+1), starting from a(0)=0. - Philippe Deléham, Oct 22 2011
If n is even and present, so is n+1. - Robert G. Wilson v, Oct 24 2014
Also: interleave binary digits of n with 0's. (Equivalent to the "rebase" interpretation above.) - M. F. Hasler, Oct 16 2018
Named after the Austrian-Canadian mathematician Leo Moser (1921-1970) and the Dutch mathematician Nicolaas Govert de Bruijn (1918-2012). - Amiram Eldar, Jun 19 2021
Conjecture: The sums of distinct powers of k > 2 can be constructed as the following (k-1)-ary rooted tree. For each n the tree grows and a(n) is then the total number of nodes. For n = 1, the root of the tree is added. For n > 1, if n is odd one leaf of depth n-2 grows one child. If n is even all leaves of depth >= (n - 1 - A000225(A001511(n/2))) grow the maximum number of children. An illustration is provided in the links. - John Tyler Rascoe, Oct 09 2022

Examples

			G.f.: x + 4*x^2 + 5*x^3 + 16*x^4 + 17*x^5 + 20*x^6 + 21*x^7 + 64*x^8 + ...
If n=27, then b_0=1, b_1=1, b_2=0, b_3=1, b_4=1. Therefore a(27) = 4^4 + 4^3 + 4 + 1 = 325; k = b_0 + b_2*2 + b_4*2^2 = 5, l = b_1 + b_3*2 = 3, such that a(5)=17, a(3)=5 and 27 = 17 + 2*5. - _Vladimir Shevelev_, Nov 10 2008
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

For generating functions Product_{k>=0} (1 + a*x^(b^k)) for the following values of (a,b) see: (1,2) A000012 and A000027, (1,3) A039966 and A005836, (1,4) A151666 and A000695, (1,5) A151667 and A033042, (2,2) A001316, (2,3) A151668, (2,4) A151669, (2,5) A151670, (3,2) A048883, (3,3) A117940, (3,4) A151665, (3,5) A151671, (4,2) A102376, (4,3) A151672, (4,4) A151673, (4,5) A151674.
Main diagonal of A048720, second column of A048723.
A062880(n) = 2*a(n); A001196(n) = 3*a(n).
Row 4 of array A104257.

Programs

  • C
    uint32_t a_next(uint32_t a_n) { return (a_n + 0xaaaaaaab) & 0x55555555; } /* Falk Hüffner, Jan 24 2022 */
  • Haskell
    a000695 n = if n == 0 then 0 else 4 * a000695 n' + b
                where (n',b) = divMod n 2
    -- Reinhard Zumkeller, Feb 21 2014, Dec 03 2011
    
  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 2)
            r += b * q
            b *= 4
        end
    r end; [a(n) for n in 0:51] |> println # Peter Luschny, Jan 03 2021
    
  • Magma
    m:=60; R:=PowerSeriesRing(Integers(), m); [0] cat Coefficients(R!( (&+[4^k*x^(2^k)/(1+x^(2^k)): k in [0..20]])/(1-x) )); // G. C. Greubel, Dec 06 2018
    
  • Maple
    a:= proc(n) local m, r, b; m, r, b:= n, 0, 1;
          while m>0 do r:= r+b*irem(m, 2, 'm'); b:= b*4 od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Mar 16 2013
  • Mathematica
    Table[FromDigits[Riffle[IntegerDigits[n, 2], 0], 2], {n, 0, 51}] (* Jacob A. Siehler, Jun 30 2010 *)
    Table[FromDigits[IntegerDigits[n, 2], 4], {n, 0, 51}] (* IWABUCHI Yu(u)ki, Apr 06 2013 *)
    Union@ Flatten@ NestList[ Join[ 4#, 4# + 1] &, {0}, 6] (* Robert G. Wilson v, Aug 30 2014 *)
    Select[ Range[0, 1320], Total@ IntegerDigits[#, 2] == Total@ IntegerDigits[#, 4] &] (* Robert G. Wilson v, Oct 24 2014 *)
    Union[FromDigits[#,4]&/@Flatten[Table[Tuples[{0,1},n],{n,6}],1]] (* Harvey P. Dale, Oct 03 2015 *)
    a[ n_] := Which[n < 1, 0, EvenQ[n], a[n/2] 4, True, a[n - 1] + 1]; (* Michael Somos, Nov 30 2016 *)
  • PARI
    a(n)=n=binary(n);sum(i=1,#n,n[i]*4^(#n-i)) \\ Charles R Greathouse IV, Mar 04 2013
    
  • PARI
    {a(n) = if( n<1, 0, n%2, a(n-1) + 1, a(n/2) * 4)}; /* Michael Somos, Nov 30 2016 */
    
  • PARI
    A000695(n)=fromdigits(binary(n),4) \\ M. F. Hasler, Oct 16 2018
    
  • Python
    def a(n):
        n = bin(n)[2:]
        x = len(n)
        return sum(int(n[i]) * 4**(x - 1 - i) for i in range(x))
    [a(n) for n in range(101)] # Indranil Ghosh, Jun 25 2017
    
  • Python
    def a():
        x = 0
        while True:
            yield x
            y = ~(x << 1)
            x = (x - y) & y # Falk Hüffner, Dec 21 2021
    
  • Python
    from itertools import count, islice
    def A000695_gen(): # generator of terms
        yield (a:=0)
        for n in count(1):
            yield (a := a+((1<<((~n & n-1).bit_length()<<1)+1)+1)//3)
    A000695_list = list(islice(A000695_gen(),30)) # Chai Wah Wu, Feb 22 2023
    
  • Python
    def A000695(n): return int(bin(n)[2:],4) # Chai Wah Wu, Aug 21 2023
    
  • Sage
    s=(sum(4^k*x^(2^k)/(1+x^(2^k)) for k in range(10))/(1-x)).series(x, 60); s.coefficients(x, sparse=False) # G. C. Greubel, Dec 06 2018
    

Formula

G.f.: 1/(1-x) * Sum_{k>=0} 4^k*x^2^k/(1+x^2^k). - Ralf Stephan, Apr 27 2003
Numbers k such that the coefficient of x^k is > 0 in Product_{n>=0} 1+x^(4^n). - Benoit Cloitre, Jul 29 2003
For n >= 1, a(n) = a(n-1) + (4^t+2)/6, where t is such that 2^t||2n,or t=A007814(2n). a(n) = (A145812(n+1) - 1)/2. - Vladimir Shevelev, Nov 07 2008
To get a(n), write n as Sum b_j*2^j, then a(n) = Sum b_j*2^(2j). The Diophantine equation a(k)+2a(l)=n has the unique solution: k=Sum b_(2j)*2^j, l=Sum b_(2j+1)*2^j. - Vladimir Shevelev, Nov 10 2008
If a(k)*a(l)=a(m), then k*l=m (the inverse, generally speaking, is not true). - Vladimir Shevelev, Nov 21 2008
Let F(x) be the generating function, then F(x)*F(x^2) = 1/(1-x). - Joerg Arndt, May 12 2010
a(n+1) = (a(n) + 1/3) & -1/3, where & is bitwise AND, -1/3 is represented as the infinite dyadic ...010101 (just as -1 is ...111111 in two's complement) and +1/3 is ...101011. - Marc LeBrun, Sep 30 2010
a(n) = Sum_{k>=0} {A030308(n,k)*b(k)} with b(k) = 4^k = A000302(k). - Philippe Deléham, Oct 18 2011
A182560(6*a(n)) = 0. - Reinhard Zumkeller, May 05 2012
G.f.: x/(1-x^2) + 4*x^2/((1-x)*(W(0) - 4*x - 4*x^2)), where W(k) = 1 + 4*x^(2^k) + 5*x^(2^(k+1)) - 4*x^(2^(k+1))*(1 + x^(2^(k+1)))^2/W(k+1); (continued fraction). - Sergei N. Gladkovskii, Jan 04 2014
liminf a(n)/n^2 = 1/3 and limsup a(n)/n^2 = 1. - Gheorghe Coserea, Sep 15 2015
Let f(x) = (Sum_{k=-oo..oo} floor(x*2^k)/4^k)/2. Then f(x) is a real-valued extension of a(n), which a(n) approximates in the sense that f(x) = lim_{k->oo} a(floor(x*2^k))/a(2^k). - Velin Yanev, Nov 28 2016
G.f. A(x) satisfies x/(1 - x^2) = A(x) - 4 * (1+x) * A(x^2). - Michael Somos, Nov 30 2016
a(2^k) = 4^k = A000302(k). a(n + 2^k) = a(n) + a(2^k) for 2^k > n >= 1. - David A. Corneth, Oct 16 2018
Sum_{n>=1} 1/a(n) = 1.886176434476107244547259512076353532930680508099044818673061351780360211128... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 12 2022

A169887 Primes in carryless arithmetic mod 10.

Original entry on oeis.org

21, 23, 25, 27, 29, 41, 43, 45, 47, 49, 51, 52, 53, 54, 56, 57, 58, 59, 61, 63, 65, 67, 69, 81, 83, 85, 87, 89, 201, 209, 227, 229, 241, 243, 261, 263, 287, 289, 403, 407, 421, 427, 443, 449, 463, 469, 481, 487, 551, 553, 557, 559, 603, 607, 623, 629, 641, 647, 661, 667, 683, 689, 801, 809, 821, 823, 847, 849, 867, 869, 881, 883
Offset: 1

Views

Author

Keywords

Comments

Define the units in carryless arithmetic mod 10 to be the numbers 1, 3, 7 and 9 (these divide any number). A prime is a number N, not a unit, whose only factorizations are of the form N = u * M, where u is a unit.
There are two types: e-type primes (A163396) and f-type (A169984).

Examples

			Examples of nonprimes: 2 = 2*51, 4 = 2*2, 10 = 52*85, 11 = 57*83, 101 = 13*17, 102 = 58 * 254 = 502 * 801, 103 = 53 * 251 = 507 * 809, 107 = 53 * 259 = 507 * 801, 108 = 58 * 256 = 502 * 809, 111 = 227 * 553.
		

Crossrefs

Cf. A004520, A059729, A168294, A168541, A169885, A169886, A169884, A169903 (primitive primes).
Cf. A169962.

A169918 Squares in carryless arithmetic mod 10 with addition of digits defined to be multiplication mod 10 and multiplication of digits defined to be addition mod 10.

Original entry on oeis.org

0, 2, 4, 6, 8, 0, 2, 4, 6, 8, 210, 242, 294, 266, 258, 260, 292, 244, 216, 208, 440, 492, 464, 456, 468, 490, 442, 414, 406, 418, 690, 662, 654, 666, 698, 640, 612, 604, 616, 648, 860, 852, 864, 896, 848, 810, 802, 814, 846, 898, 50, 62, 94, 46, 18, 0, 12, 44, 96, 68, 260, 292
Offset: 0

Views

Author

Keywords

Comments

The rules of arithmetic used in A169916, A169917, A169918 have very strange consequences. Many of the familiar laws fail. For instance, the arithmetic in A169916 is not associative: 10*(9*2) = 10*1 = 21 != (10*9)*2 = 9*2 = 1.

Examples

			a(17) = 17*17 = 244:
...17
...17
-----
...84 (7*7 = 7+7 mod 10 = 4, 7*1 = 7+1 mod 10 = 8)
..28.
-----
..244
(The rule for "adding" the columns is to multiply mod 10: 8+8 = 8 * 8 mod 10 = 4. Blanks are ignored)
		

Crossrefs

See A048379, A169931-A169933, A169935 for other examples of calculations in this version of arithmetic.
The four versions are A059729, A169916, A169917, A169918.

Programs

  • PARI
    A169918(n)={u=vector(#n=digits(n),i,1);n=apply(d->n+d*u,n)%10;sum(i=0,2*#n-2,prod(j=max(1,#n-i),min(2*#n-1-i,#n),n[2*#n-i-j][j])%10*10^i)} \\ M. F. Hasler, Mar 26 2015

Extensions

Thanks to Rick L. Shepherd for pointing out a typo in the example. - N. J. A. Sloane, Nov 08 2014

A169999 Carryless product n X n in base 3.

Original entry on oeis.org

0, 1, 1, 9, 16, 13, 9, 13, 16, 81, 100, 91, 144, 142, 157, 117, 112, 133, 81, 91, 100, 117, 133, 112, 144, 157, 142, 729, 784, 757, 900, 961, 931, 819, 877, 853, 1296, 1369, 1333, 1278, 1249, 1237, 1413, 1381, 1456, 1053, 1117, 1099, 1008, 997, 1030, 1197, 1183, 1141
Offset: 0

Views

Author

N. J. A. Sloane, Aug 29 2010

Keywords

Crossrefs

Main diagonal of A325820.
For bases 2 through 10 see A000695, A169999, A170985-A170990 and A059729.

Programs

A170990 Carryless product n X n in base 9.

Original entry on oeis.org

0, 1, 4, 0, 7, 7, 0, 4, 1, 81, 100, 121, 135, 160, 97, 108, 130, 145, 324, 361, 400, 351, 394, 349, 378, 337, 370, 0, 55, 31, 0, 61, 34, 0, 58, 28, 567, 640, 634, 621, 619, 610, 594, 589, 577, 567, 577, 589, 594, 610, 619, 621, 634, 640, 0, 28, 58, 0, 34, 61, 0, 31, 55, 324, 370
Offset: 0

Views

Author

N. J. A. Sloane, Aug 29 2010

Keywords

Crossrefs

For bases 2 through 10 see A000695, A169999, A170985-A170990 and A059729. A169821 is a less satisfactory variant.

Programs

  • PARI
    a(n) = fromdigits(Vec(Pol(digits(n, 9))^2)%9, 9); \\ Seiichi Manyama, Mar 09 2023

A168294 Carryless product n times n+1.

Original entry on oeis.org

0, 2, 6, 2, 0, 0, 2, 6, 2, 90, 110, 132, 156, 172, 190, 110, 132, 156, 172, 280, 420, 462, 406, 442, 480, 420, 462, 406, 442, 670, 930, 992, 956, 912, 970, 930, 992, 956, 912, 260, 640, 622, 606, 682, 660, 640, 622, 606, 682, 50, 550, 552, 556, 552, 550, 550, 552, 556, 552
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Python
    def A168294(n):
        s, t = [int(d) for d in str(n)], [int(d) for d in str(n+1)]
        l, m = len(s), len(t)
        u = [0]*(l+m-1)
        for i in range(l):
            for j in range(m):
                u[i+j] = (u[i+j] + s[i]*t[j]) % 10
        return int("".join(str(d) for d in u)) # Chai Wah Wu, Jun 30 2020

A169885 Cubes (n * n * n) in carryless arithmetic mod 10.

Original entry on oeis.org

0, 1, 8, 7, 4, 5, 6, 3, 2, 9, 1000, 1331, 1628, 1977, 1284, 1555, 1886, 1173, 1422, 1739, 8000, 8261, 8448, 8647, 8864, 8005, 8266, 8443, 8642, 8869, 7000, 7791, 7468, 7117, 7844, 7555, 7246, 7913, 7662, 7399, 4000, 4821, 4688, 4487, 4224, 4005, 4826, 4683
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • PARI
    a(n) = fromdigits(Vec(Pol(digits(n))^3)%10); \\ Seiichi Manyama, Mar 09 2023

A169886 Fourth powers (n * n * n * n) in carryless arithmetic mod 10.

Original entry on oeis.org

0, 1, 6, 1, 6, 5, 6, 1, 6, 1, 10000, 14641, 18426, 12481, 16666, 10005, 14646, 18421, 12486, 16661, 60000, 62481, 64646, 66661, 68426, 60005, 62486, 64641, 66666, 68421, 10000, 18421, 16666, 14641, 12486, 10005, 18426, 16661, 14646, 12481, 60000, 66661, 62486
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • PARI
    a(n) = fromdigits(Vec(Pol(digits(n))^4)%10); \\ Seiichi Manyama, Mar 09 2023

A170985 Carryless product n X n in base 4.

Original entry on oeis.org

0, 1, 0, 1, 16, 25, 16, 25, 0, 1, 0, 1, 16, 25, 16, 25, 256, 289, 256, 289, 400, 441, 400, 441, 256, 289, 256, 289, 400, 441, 400, 441, 0, 1, 0, 1, 16, 25, 16, 25, 0, 1, 0, 1, 16, 25, 16, 25, 256, 289, 256, 289, 400, 441, 400, 441, 256, 289, 256, 289, 400, 441, 400, 441, 4096, 4225
Offset: 0

Views

Author

N. J. A. Sloane, Aug 29 2010

Keywords

Crossrefs

For bases 2 through 10 see A000695, A169999, A170985-A170990 and A059729.

Programs

  • PARI
    a(n) = fromdigits(Vec(Pol(digits(n, 4))^2)%4, 4); \\ Seiichi Manyama, Mar 09 2023

A169884 Numbers consisting of either all even digits or just 5's and 0's.

Original entry on oeis.org

0, 2, 4, 5, 6, 8, 20, 22, 24, 26, 28, 40, 42, 44, 46, 48, 50, 55, 60, 62, 64, 66, 68, 80, 82, 84, 86, 88, 200, 202, 204, 206, 208, 220, 222, 224, 226, 228, 240, 242, 244, 246, 248, 260, 262, 264, 266, 268, 280, 282, 284, 286, 288, 400, 402, 404, 406
Offset: 1

Views

Author

Keywords

Comments

These are all the divisors of zero in carryless arithmetic mod 10. E.g. 5 * 44 = 0.

Crossrefs

Programs

  • Mathematica
    With[{upto=410},Select[Union[Join[Select[Range[upto],And@@EvenQ[ IntegerDigits[#]]&], FromDigits/@Tuples[{5,0},Ceiling[Log[ 10,upto]]]]],#<=upto&]] (* Harvey P. Dale, Aug 05 2011 *)
    elect[Range[0,500],AllTrue[IntegerDigits[#],EvenQ]||SubsetQ[{0,5},IntegerDigits[#]]&] (* Harvey P. Dale, Aug 22 2025 *)
Showing 1-10 of 26 results. Next