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

A261891 Least k>0 such that n AND (k*n) = 0, where AND stands for the binary AND operator.

Original entry on oeis.org

2, 2, 4, 2, 2, 4, 8, 2, 2, 2, 12, 4, 10, 8, 16, 2, 2, 2, 4, 2, 2, 12, 24, 4, 4, 10, 12, 8, 10, 16, 32, 2, 2, 2, 4, 2, 2, 4, 40, 2, 2, 2, 12, 12, 10, 24, 48, 4, 4, 4, 4, 10, 34, 12, 56, 8, 18, 10, 12, 16, 42, 32, 64, 2, 2, 2, 4, 2, 2, 4, 8, 2, 2, 2, 12, 4, 10
Offset: 1

Views

Author

Paul Tek, Sep 05 2015

Keywords

Comments

All terms are even.
a(A003714(n)) = 2 for any n>0.
a(A004780(n)) > 2 for any n>0.
a(n) <= 2^A116361(n) for any n>0.
a(2n) = a(n) for any n>0.

Examples

			For n=7:
+---+-------------+
| k | 7 AND (k*7) |
|   | (in binary) |
+---+-------------+
| 1 |         111 |
| 2 |         110 |
| 3 |         101 |
| 4 |         100 |
| 5 |          11 |
| 6 |          10 |
| 7 |           1 |
| 8 |           0 |
+---+-------------+
Hence, a(7) = 8.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 1; While[BitAnd[k n, n] != 0, k++]; k, {n, 60}] (* Michael De Vlieger, Sep 06 2015 *)
  • PARI
    a(n) = {k=1; while (bitand(n, k*n), k++); k;} \\ Michel Marcus, Sep 06 2015
    
  • Perl
    sub a {
       my $n = shift;
       my $k = 1;
       while ($n & ($k*$n)) {
          $k++;
       }
       return $k;
    }
    
  • Python
    from itertools import count
    def A261891(n): return next(k for k in count(2) if not n&k*n) # Chai Wah Wu, Jul 19 2024

A353624 a(0) = 0, and for n > 0, a(n) is the least multiple of n that can be added to n without carries in balanced ternary.

Original entry on oeis.org

0, 2, 6, 6, 8, 30, 18, 21, 16, 18, 20, 55, 24, 26, 84, 90, 80, 51, 54, 57, 60, 63, 132, 46, 48, 75, 52, 54, 56, 87, 60, 62, 288, 165, 408, 70, 72, 74, 456, 78, 80, 246, 252, 516, 484, 270, 276, 658, 240, 441, 400, 153, 156, 159, 162, 165, 168, 171, 522, 649
Offset: 0

Views

Author

Rémy Sigrist, Apr 30 2022

Keywords

Comments

Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.

Examples

			For n = 5:
- we consider the following cases:
      k  bter(k*5)  carries?
      -  ---------  --------
      1        1TT  yes
      2        101  yes
      3       1TT0  yes
      4       1T1T  yes
      5       10T1  yes
      6       1010  no
- so a(5) = 6*5 = 30.
		

Crossrefs

Cf. A059095, A261892 (binary analog), A353623.

Programs

  • PARI
    ok(u,v) = { while (u && v, my (uu=[0,+1,-1][1+u%3], vv=[0,+1,-1][1+v%3]); if (abs(uu+vv)>1, return (0)); u=(u-uu)/3; v=(v-vv)/3); return (1) }
    a(n) = for (k=1, oo, if (ok(n, n*k), return (n*k)))

Formula

a(n) = n * A353623(n).
a(3*n) = 3*a(n).

A374736 a(n) is the least number of the form k*n for some k > 0 that can be added to n without carries in decimal.

Original entry on oeis.org

0, 1, 2, 3, 4, 10, 12, 21, 40, 90, 10, 11, 12, 13, 14, 30, 32, 51, 180, 380, 20, 21, 22, 23, 24, 50, 52, 162, 140, 870, 30, 31, 32, 33, 34, 140, 252, 111, 760, 1560, 40, 41, 42, 43, 44, 450, 230, 141, 240, 2450, 100, 102, 104, 106, 324, 110, 112, 342, 1740
Offset: 0

Views

Author

Rémy Sigrist, Jul 18 2024

Keywords

Examples

			For n = 8:
- 1*8 = 8; computing 8 + 8 requires a carry,
- 2*8 = 16; computing 8 + 16 requires a carry,
- 3*8 = 24; computing 8 + 24 requires a carry,
- 4*8 = 32; computing 8 + 32 requires a carry,
- 5*8 = 40; computing 8 + 40 does not require a carry,
- so a(8) = 40.
		

Crossrefs

Cf. A007091, A261892 (analog for binary), A353624 (analog for balanced ternary), A374735.

Programs

  • PARI
    a(n, base = 10) = { for (k = 1, oo, if (sumdigits((k+1)*n, base) == sumdigits(n, base) + sumdigits(k*n, base), return (k*n); ); ); }
    
  • Python
    from itertools import count
    def A374736(n):
        s = list(map(int,str(n)[::-1]))
        return next(k for k in count(n,n) if all(a+b<=9 for a, b in zip(s,map(int,str(k)[::-1])))) # Chai Wah Wu, Jul 19 2024

Formula

a(n) = A374735(n) * n.
a(n) = n iff n belongs to A007091.
a(10*n) = 10*a(n).
Showing 1-3 of 3 results.