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

A295989 Irregular triangle T(n, k), read by rows, n >= 0 and 0 <= k < A001316(n): T(n, k) is the (k+1)-th nonnegative number m such that n AND m = m (where AND denotes the bitwise AND operator).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Dec 02 2017

Keywords

Comments

The (n+1)-th row has A001316(n) terms and sums to n * A001316(n) / 2.
For any n >= 0 and k such that 0 <= k < A001316(n):
- if A000120(n) > 0 then T(n, 1) = A006519(n),
- if A000120(n) > 1 then T(n, 2) = 2^A285099(n),
- if A000120(n) > 0 then T(n, A001316(n)/2 - 1) = A053645(n),
- if A000120(n) > 0 then T(n, A001316(n)/2) = 2^A000523(n),
- if A000120(n) > 0 then T(n, A001316(n) - 2) = A129760(n),
- T(n, A001316(n) - 1) = n,
- the six previous relations correspond respectively (when applicable) to the second term, the third term, the pair of central terms, the penultimate term and the last term of a row,
- T(n, k) AND T(n, A001316(n) - k - 1) = 0,
- T(n, k) + T(n, A001316(n) - k - 1) = n,
- T(n, k) = k for any k < A006519(n+1),
- A000120(T(n, k)) = A000120(k).
If we plot (n, T(n,k)) then we obtain a skewed Sierpinski triangle (see Links section).
If interpreted as a flat sequence a(n) for n >= 0:
- a(n) = 0 iff n = A006046(k) for some k >= 0,
- a(n) = 1 iff n = A006046(2*k + 1) + 1 for some k >= 0,
- a(A006046(k) - 1) = k - 1 for any k > 0.

Examples

			Triangle begins:
  0:   [0]
  1:   [0, 1]
  2:   [0, 2]
  3:   [0, 1, 2, 3]
  4:   [0, 4]
  5:   [0, 1, 4, 5]
  6:   [0, 2, 4, 6]
  7:   [0, 1, 2, 3, 4, 5, 6, 7]
  8:   [0, 8]
  9:   [0, 1, 8, 9]
  10:  [0, 2, 8, 10]
  11:  [0, 1, 2, 3, 8, 9, 10, 11]
  12:  [0, 4, 8, 12]
  13:  [0, 1, 4, 5, 8, 9, 12, 13]
  14:  [0, 2, 4, 6, 8, 10, 12, 14]
  15:  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
		

Crossrefs

First column of array in A352909.

Programs

  • Mathematica
    A295989row[n_] := Select[Range[0, n], BitAnd[#, n-#] == 0 &];
    Array[A295989row, 25, 0] (* Paolo Xausa, Feb 24 2024 *)
  • PARI
    T(n,k) = if (k==0, 0, n%2==0, 2*T(n\2,k), k%2==0, 2*T(n\2, k\2), 2*T(n\2, k\2)+1)

Formula

For any n >= 0 and k such that 0 <= k < A001316(n):
- T(n, 0) = 0,
- T(2*n, k) = 2*T(n, k),
- T(2*n+1, 2*k) = 2*T(n, k),
- T(2*n+1, 2*k+1) = 2*T(n, k) + 1.

A285097 a(n) = difference between the positions of two least significant 1-bits in base-2 representation of n, or 0 if there are less than two 1-bits in n (when n is either zero or a power of 2).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 1, 1, 0, 3, 2, 1, 1, 2, 1, 1, 0, 4, 3, 1, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 5, 4, 1, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 1, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 6, 5, 1, 4, 2, 1, 1, 3, 3, 2, 1, 1, 2, 1, 1, 2, 4, 3, 1, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 5, 4, 1, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 1, 2, 2, 1, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 20 2017

Keywords

Comments

a(1+n) is the length of the least significant run of 0-bits in n, or 0 if n is one of terms of A000225. - Antti Karttunen, Oct 14 2023

Examples

			For n = 3, "11" in binary, the second least significant 1-bit (the second 1-bit from the right) is at position 1 and the rightmost 1-bit is at position 0, thus a(3) = 1-0 = 1.
For n = 4, "100" in binary, there is just one 1-bit present, thus a(4) = 0.
For n = 5, "101" in binary, the second 1-bit from the right is at position 2, and the least significant 1 is at position 0, thus a(5) = 2-0 = 2.
For n = 26, "11010" in binary, the second 1-bit from the right is at position 3, and the least significant 1 is at position 1, thus a(26) = 3-1 = 2.
		

Crossrefs

Programs

  • Mathematica
    a007814[n_]:=IntegerExponent[n, 2]; a285099[n_]:=If[DigitCount[n, 2, 1]<2, 0, a007814[BitAnd[n, n - 1]]]; a[n_]:=If[DigitCount[n, 2, 1]<2, 0,a285099[n] - a007814[n]]; Table[a[n], {n, 0, 150}] (* Indranil Ghosh, Apr 20 2017 *)
  • PARI
    A285097(n) = if(!n || !bitand(n,n-1), 0, valuation((n>>valuation(n,2))-1, 2)); \\ Antti Karttunen, Oct 14 2023
  • Python
    import math
    def a007814(n): return int(math.log(n - (n & n - 1), 2))
    def a285099(n): return 0 if bin(n)[2:].count("1") < 2 else a007814(n & (n - 1))
    def a(n): return 0 if bin(n)[2:].count("1")<2 else a285099(n) - a007814(n) # Indranil Ghosh, Apr 20 2017
    
  • Scheme
    (define (A285097 n) (if (<= (A000120 n) 1) 0 (- (A285099 n) (A007814 n))))
    

Formula

If A000120(n) < 2, a(n) = 0, otherwise a(n) = A285099(n) - A007814(n) = A007814(A129760(n)) - A007814(n).
a(n) = 0 if n is 0 or of the form 2^k, (k>=0), otherwise a(n) = v_2(A000265(n)-1), where v_2(i) = A007814(i). - Ridouane Oudra, Oct 20 2019

A285110 a(n) = A001222(A285323(n)).

Original entry on oeis.org

0, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Apr 19 2017

Keywords

Comments

The sequence is completely determined by the positions of two least significant 1-bits of n: After initial zero, if n is a power of two (only one 1-bit present) or if prime(1+A285099(n)) > prime(1+A007814(n))^2, a(n) = 2, otherwise a(n) = 1.

Crossrefs

Programs

  • Python
    from operator import mul
    from sympy import prime, primefactors
    from functools import reduce
    def a001222(n): return 0 if n<2 else a001222(n//min(primefactors(n))) + 1
    def a019565(n): return reduce(mul, (prime(i+1) for i, v in enumerate(bin(n)[:1:-1]) if v == '1')) if n > 0 else 1 # This function from Chai Wah Wu
    def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
    def a065642(n):
        if n==1: return 1
        r=a007947(n)
        n += r
        while a007947(n)!=r:
            n+=r
        return n
    def a285323(n): return a065642(a065642(a019565(n)))//a019565(n)
    def a(n): return a001222(a285323(n))
    print([a(n) for n in range(121)]) # Indranil Ghosh, Apr 20 2017
  • Scheme
    (define (A285110 n) (A001222 (A285323 n)))
    (define (A285110 n) (cond ((zero? n) n) ((or (= 1 (A000120 n)) (> (A000040 (+ 1 (A285099 n))) (A000290 (A000040 (+ 1 (A007814 n)))))) 2) (else 1)))
    

Formula

a(n) = A001222(A285323(n)).

A285323 a(n) = A065642(A065642(A019565(n))) / A019565(n).

Original entry on oeis.org

1, 4, 9, 3, 25, 4, 5, 3, 49, 4, 7, 3, 7, 4, 5, 3, 121, 4, 9, 3, 11, 4, 5, 3, 11, 4, 7, 3, 7, 4, 5, 3, 169, 4, 9, 3, 13, 4, 5, 3, 13, 4, 7, 3, 7, 4, 5, 3, 13, 4, 9, 3, 11, 4, 5, 3, 11, 4, 7, 3, 7, 4, 5, 3, 289, 4, 9, 3, 17, 4, 5, 3, 17, 4, 7, 3, 7, 4, 5, 3, 17, 4, 9, 3, 11, 4, 5, 3, 11, 4, 7, 3, 7, 4, 5, 3, 17, 4, 9, 3, 13, 4, 5, 3, 13, 4, 7, 3, 7, 4, 5, 3
Offset: 0

Views

Author

Antti Karttunen, Apr 19 2017

Keywords

Comments

After the initial a(0)=1, the third row of array A285321 divided by its first row. After 1, all terms are either primes or squares of primes. See A285110.
The sequence is completely determined by the positions of two least significant 1-bits of n: After initial zero, if n is a power of two (only one 1-bit present) or if prime(1+A285099(n)) > prime(1+A007814(n))^2, a(n) = prime(1+A007814(n))^2 = A020639(A019565(n))^2, otherwise a(n) = prime(1+A285099(n)) = A014673(A019565(n)).

Crossrefs

Programs

Formula

a(n) = A065642(A065642(A019565(n))) / A019565(n).
Showing 1-4 of 4 results.