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

A365805 a(n) = largest exponent m for which a representation of the form A163511(n) = k^m exists (for some k). a(0) = 0 by convention.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 01 2023

Keywords

Comments

Equivalently, the largest exponent m for which a representation of the form A332214(n) = k^m exists (for some k), or similarly, for any other such variant of A163511, like A332817.

Crossrefs

Cf. A365808 (positions of even terms), A365801 (multiples of 3), A365802 (multiples of 5), A366287 (multiples of 7), A366391 (multiples of 11).

Programs

  • PARI
    A052409(n) = { my(k=ispower(n)); if(k, k, n>1); };
    A163511(n) = if(!n, 1, my(p=2, t=1); while(n>1, if(!(n%2), (t*=p), p=nextprime(1+p)); n >>= 1); (t*p));
    A365805(n) = A052409(A163511(n));

Formula

a(n) = A052409(A163511(n)).
If a(n) > 1 (or A052409(n) > 1), then a(n) <> A052409(n). [Consider A366370]

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
Showing 1-2 of 2 results.