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-8 of 8 results.

A067138 OR-numbral multiplication table, read by antidiagonals.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 3, 4, 3, 0, 0, 4, 6, 6, 4, 0, 0, 5, 8, 7, 8, 5, 0, 0, 6, 10, 12, 12, 10, 6, 0, 0, 7, 12, 15, 16, 15, 12, 7, 0, 0, 8, 14, 14, 20, 20, 14, 14, 8, 0, 0, 9, 16, 15, 24, 21, 24, 15, 16, 9, 0, 0, 10, 18, 24, 28, 30, 30, 28, 24, 18, 10, 0, 0, 11, 20, 27, 32, 31, 28
Offset: 0

Views

Author

Jens Voß, Jan 02 2002

Keywords

Comments

See A048888 for the definition of OR-numbral arithmetic

Examples

			The top left 0..16 x 0..16 corner of the array:
  0,  0,  0,  0,  0,  0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  0,  1,  2,  3,  4,  5,  6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  0,  2,  4,  6,  8, 10, 12,  14,  16,  18,  20,  22,  24,  26,  28,  30,
  0,  3,  6,  7, 12, 15, 14,  15,  24,  27,  30,  31,  28,  31,  30,  31,
  0,  4,  8, 12, 16, 20, 24,  28,  32,  36,  40,  44,  48,  52,  56,  60,
  0,  5, 10, 15, 20, 21, 30,  31,  40,  45,  42,  47,  60,  61,  62,  63,
  0,  6, 12, 14, 24, 30, 28,  30,  48,  54,  60,  62,  56,  62,  60,  62,
  0,  7, 14, 15, 28, 31, 30,  31,  56,  63,  62,  63,  60,  63,  62,  63,
  0,  8, 16, 24, 32, 40, 48,  56,  64,  72,  80,  88,  96, 104, 112, 120,
  0,  9, 18, 27, 36, 45, 54,  63,  72,  73,  90,  91, 108, 109, 126, 127,
  0, 10, 20, 30, 40, 42, 60,  62,  80,  90,  84,  94, 120, 122, 124, 126,
  0, 11, 22, 31, 44, 47, 62,  63,  88,  91,  94,  95, 124, 127, 126, 127,
  0, 12, 24, 28, 48, 60, 56,  60,  96, 108, 120, 124, 112, 124, 120, 124,
  0, 13, 26, 31, 52, 61, 62,  63, 104, 109, 122, 127, 124, 125, 126, 127,
  0, 14, 28, 30, 56, 62, 60,  62, 112, 126, 124, 126, 120, 126, 124, 126,
  0, 15, 30, 31, 60, 63, 62,  63, 120, 127, 126, 127, 124, 127, 126, 127,
  0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240,
.
Multiplying 3 ("11" in binary) with itself in this system means taking bitwise-or of "11" with itself, when shifted one bit-position left:
       11
      110
  -------
OR:   111 = 7 in decimal = A(3,3).
.
Multiplying 10 (= "1010" in binary) and 11 (= "1011" in binary) in this system means taking bitwise-or of binary number 1011 when shifted once left with the same binary number when shifted three bit-positions left:
      10110
    1011000
    -------
OR: 1011110 = 94 in decimal = A(10,11) = A(11,10).
		

Crossrefs

Cf. A003986, A067139, A048888, A007059, A067398 (main diagonal).
Cf. also A004247, A048720 for analogous multiplication tables.

Programs

  • PARI
    t(n, k) = {res = 0; for (i=0, length(binary(n))-1, if (bittest(n, i), res = bitor(res, shift(k, i)));); return (res);} \\ Michel Marcus, Apr 14 2013

Formula

From Rémy Sigrist, Mar 17 2021: (Start)
T(n, 0) = 0.
T(n, 1) = n.
T(n, 2^k) = n*2^k for any k >= 0.
T(n, n) = A067398(n).
(End)
For all n, k: A048720(n,k) <= A(n,k) <= A004247(n,k). - Antti Karttunen, Mar 17 2021

Extensions

Example-section rewritten by Antti Karttunen, Mar 17 2021

A067399 Number of divisors of n in OR-numbral arithmetic.

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 3, 4, 2, 4, 2, 6, 2, 6, 5, 5, 2, 4, 2, 6, 3, 4, 2, 8, 2, 4, 4, 9, 2, 10, 8, 6, 2, 4, 2, 6, 2, 4, 2, 8, 2, 6, 2, 6, 4, 4, 4, 10, 2, 4, 4, 6, 2, 8, 4, 12, 2, 4, 4, 15, 4, 16, 14, 7, 2, 4, 2, 6, 2, 4, 2, 8, 3, 4, 2, 6, 2, 4, 2, 10, 2, 4, 2, 9, 5, 4, 2, 8, 2, 8, 4, 6, 2, 8, 6, 12, 2, 4, 4, 6
Offset: 1

Views

Author

Jens Voß, Jan 23 2002

Keywords

Comments

See A048888 for the definition of OR-numbral arithmetic. The example shows that this sequence is not multiplicative.
In other words, number of lunar divisors of n in base 2.

Examples

			a(15)=5 since [15] has the 5 OR-numbral divisors [1], [3], [5], [7] and [15].
If written as a triangle with rows of lengths 1,2,4,8,16,...:
1,
2, 2,
3, 2, 4, 3,
4, 2, 4, 2, 6, 2, 6, 5,
5, 2, 4, 2, 6, 3, 4, 2, 8, 2, 4, 4, 9, 2, 10, 8,
6, 2, 4, 2, 6, 2, 4, 2, 8, 2, 6, 2, 6, 4, 4, 4, 10, 2, 4, 4, 6, 2, 8, 4, 12, 2, 4, 4, 15, 4, 16, 14,
...,
the last terms in each row give A079500(n). The penultimate terms in the rows give 2*A079500(n-1). - _N. J. A. Sloane_, Mar 05 2011
		

Crossrefs

A079500 is the subsequence a(2^k-1). - N. J. A. Sloane, Feb 23 2011
See A188548 for the sum of the divisors.

A067400 Non-uniquely factorizable OR-numbrals, i.e., numbrals for which there exist more than one different factorizations into irreducible factors (modulo order).

Original entry on oeis.org

15, 30, 31, 60, 62, 63, 85, 95, 111, 120, 123, 124, 125, 126, 127, 170, 175, 190, 191, 207, 222, 223, 239, 240, 243, 245, 246, 247, 248, 250, 251, 252, 253, 254, 255, 340, 341, 350, 351, 367, 379, 380, 381, 382, 383, 399, 414, 415, 443, 444, 445, 446, 447
Offset: 1

Views

Author

Jens Voß, Jan 24 2002

Keywords

Comments

See A048888 for the definition of OR-numbral arithmetic.

Examples

			15 is in A067400 since [15] = [3] * [5] = [3]^3 and [3] and [5] are irreducible.
		

Crossrefs

A067401 Minimal non-uniquely factorizable OR-numbrals, i.e., numbrals that are not uniquely factorizable but for which all proper divisors are.

Original entry on oeis.org

15, 85, 95, 111, 123, 125, 175, 191, 207, 223, 239, 243, 245, 247, 251, 253, 351, 367, 379, 381, 399, 415, 443, 445, 447, 463, 483, 487, 493, 499, 501, 507, 585, 603, 621, 631, 639, 685, 687, 701, 725, 729, 731, 735, 757, 763, 783, 799, 827, 831, 873, 877
Offset: 1

Views

Author

Jens Voß, Jan 24 2002

Keywords

Comments

See A048888 for the definition of OR-numbral arithmetic.

Examples

			15 is in A067401 since [15] = [3] * [5] = [3]^3 all divisors of [15] are uniquely factorizable.
		

Crossrefs

A190820 In base-2 lunar arithmetic, number of distinct squares of length 2n+1.

Original entry on oeis.org

2, 2, 4, 8, 15, 29, 55, 105, 197, 367, 678, 1261, 2326, 4293, 7902, 14431, 26363, 47899
Offset: 0

Views

Author

N. J. A. Sloane, Jun 01 2011

Keywords

Crossrefs

Programs

  • Maple
    rebase := proc(L)
        add( op(i,L)*2^(i-1),i=1..nops(L)) ;
    end proc:
    dismadd := proc(a,b)
        local adgs,bdgs,alen,blen,L,i ;
        adgs := convert(a,base,2) ;
        bdgs := convert(b,base,2) ;
        alen := nops(adgs) ;
        blen := nops(bdgs) ;
        L := [] ;
        for i from 1 to max(alen,blen) do
            if i <= alen and i <= blen then
                L := [op(L),max(op(i,adgs),op(i,bdgs))] ;
            elif i <= alen then
                L := [op(L),op(i,adgs)] ;
            else
                L := [op(L),op(i,bdgs)] ;
            end if;
        end do:
        rebase(L) ;
    end proc:
    dismult := proc(a,b)
        local bdgs,blen,c,i ;
        if b = 0 then
            return 0;
        end if;
        bdgs := convert(b,base,2) ;
        blen := nops(bdgs) ;
        if blen = 1 then
            # cannot be 0 (already above), so b=1
            return a;
        else
            c := 0 ;
            for i from 1 to blen do
                if op(i,bdgs) <> 0 then
                    c := dismadd(c, 2^(i-1)*a ) ;
                end if;
            end do:
        end if;
        c ;
    end proc:
    A190820 := proc(n)
        local c,sq;
        sq := {} ;
        # length of square is 2*n+1 = 2*len(i)-1, so len(i)=n+1.
        for c from 2^n to 2^(n+1)-1 do
            sq := sq union { dismult(c,c) } ;
        end do:
        nops(sq) ;
    end proc:

Formula

a(n) = #{k in A067398: A070939(k)=2*n+1}. - R. J. Mathar, Nov 23 2015

Extensions

a(16) and a(17) from R. J. Mathar, Nov 23 2015

A263402 Define Z(1) = {1}, and Z(n+1) = Z(n) (+) { x+y, with x and y in Z(n) } for any n>0 (where (+) stands for the symmetric difference of two sets). Then a(n) gives the number of elements in Z(n).

Original entry on oeis.org

1, 2, 3, 7, 10, 22, 42, 87, 170, 342, 686, 1365, 2727, 5468, 10919, 21857, 43680, 87389, 174756, 349539, 699039, 1398115, 2796191, 5592422, 11184795, 22369639, 44739229, 89478503, 178956950, 357913967, 715827858, 1431655793, 2863311503, 5726623097, 11453246088
Offset: 1

Views

Author

Paul Tek, Oct 17 2015

Keywords

Comments

a(n) can also be interpreted as the number of ON cells at the n-th stage of the following automaton:
- At first stage, we have only one ON cell at position 1,
- An ON cell appears at position x+y if the cells at positions x and y are ON,
- An ON cell dies at position x+y if the cells at positions x and y are ON.
a(n) <= 2^(n-1) for any n>0.

Examples

			Z(1) = {1};
Z(2) = {1} (+) {2} = {1,2};
Z(3) = {1,2} (+) {2,3,4} = {1,3,4};
Z(4) = {1,3,4} (+) {2,4,5,6,7,8} = {1,2,3,5,6,7,8};
Hence: a(1) = 1, a(2) = 2, a(3) = 3 and a(4) = 7.
		

Crossrefs

Cf. A067398.

Programs

  • PARI
    lista(nn) = {zprec = Set([1]); print1(#zprec, ", "); for (n=2, nn, zs = setbinop((x,y)->x+y, zprec); zn = setminus(setunion(zprec, zs), setintersect(zprec, zs)); print1(#zn, ", "); zprec = zn;);} \\ Michel Marcus, Oct 20 2015
  • Perl
    See Links section.
    

Formula

a(n) = A000120(z(n)) for any n>0
where z(n) is a binary encoding of Z(n), defined as follows:
- z(1) = 2^1,
- z(n+1) = z(n) XOR A067398(z(n)) for any n>0 (where XOR stands for the binary XOR operator).

A348363 The 1's in the binary expansion of a(n) encode the distances between the 1's in the binary expansion of n.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 15, 3, 15, 7, 15, 1, 17, 9, 27, 5, 21, 15, 31, 3, 27, 15, 31, 7, 31, 15, 31, 1, 33, 17, 51, 9, 45, 27, 63, 5, 45, 21, 63, 15, 47, 31, 63, 3, 51, 27, 59, 15, 63, 31, 63, 7, 63, 31, 63, 15, 63, 31, 63, 1, 65, 33, 99, 17, 85, 51
Offset: 0

Views

Author

Rémy Sigrist, Oct 15 2021

Keywords

Comments

The bit 2^d is set in a(n) iff for some e >= 0, the bits 2^e and 2^(e+d) are set in n.
This sequence has similarities with A067398; here we take the absolute differences, there the sums, of indices of 1's in binary expansions.
All terms are odd, except a(0) = 0.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     1      10          1
   3     3      11         11
   4     1     100          1
   5     5     101        101
   6     3     110         11
   7     7     111        111
   8     1    1000          1
   9     9    1001       1001
  10     5    1010        101
  11    15    1011       1111
  12     3    1100         11
  13    15    1101       1111
  14     7    1110        111
  15    15    1111       1111
		

Crossrefs

Programs

  • Mathematica
    {0}~Join~Array[Total[2^Append[Union@ Abs[Subtract @@@ Permutations[1 + Length[#] - Position[#, 1][[All, 1]] &@ IntegerDigits[#, 2], {2}]], 0]] &, 70] (* Michael De Vlieger, Oct 16 2021 *)
  • PARI
    a(n) = { my (b=vector(hammingweight(n))); for (k=1, #b, n-=2^b[k]=valuation(n, 2);); my (p=setbinop((i,j)->abs(i-j), b)); sum (k=1, #p, 2^p[k]) }
    
  • Python
    def a(n):
        locs = [e for e in range(n.bit_length()) if 1 & (n>>e)]
        diffs = set(abs(e1-e2) for i, e1 in enumerate(locs) for e2 in locs[i:])
        return sum(2**d for d in diffs)
    print([a(n) for n in range(71)]) # Michael S. Branicky, Oct 16 2021

Formula

a(2*n) = a(n).
a(n) = n iff n = 0 or n belongs to A064896.
a(n) = 1 iff n is a power of 2 (A000079).
a(n) = 3 iff n belongs to A007283.
a(n) = 5 iff n belongs to A020714.
a(n) AND n = n for any odd number n (where AND denotes the bitwise AND operator).

A171222 Squares in lunar arithmetic in base 2 written in base 2.

Original entry on oeis.org

0, 1, 100, 111, 10000, 10101, 11100, 11111, 1000000, 1001001, 1010100, 1011111, 1110000, 1111100, 1111101, 1111111, 100000000, 100010001, 100100100, 100110111, 101010000, 101010101, 101111100, 101111111, 111000000, 111011001
Offset: 0

Views

Author

N. J. A. Sloane, Oct 02 2010

Keywords

Crossrefs

Cf. A067398.
Showing 1-8 of 8 results.