A204892 Least k such that n divides s(k)-s(j) for some j in [1,k), where s(k)=prime(k).
2, 3, 3, 4, 4, 5, 7, 5, 5, 6, 6, 7, 10, 7, 7, 8, 8, 9, 13, 9, 9, 10, 16, 10, 16, 10, 10, 11, 11, 12, 19, 12, 20, 12, 12, 13, 22, 13, 13, 14, 14, 15, 24, 15, 15, 16, 25, 16, 26, 16, 16, 17, 29, 17, 30, 17, 17, 18, 18, 19, 31, 19, 32, 19, 19, 20, 33, 20, 20, 21
Offset: 1
Keywords
A135481 a(n) = 2^A007814(n+1) - 1.
0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 63, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0
Offset: 0
Comments
This is Guy Steele's sequence GS(1, 6) (see A135416).
Links
- Antti Karttunen, Table of n, a(n) for n = 0..16384
Programs
-
Julia
using IntegerSequences A135481List(len) = [Bits("CNIMP", n+1, n) for n in 0:len] println(A135481List(100)) # Peter Luschny, Sep 25 2021
-
Maple
GS(1,6,200); # see A135416
-
Mathematica
Table[BitAnd[i, BitNot[i+1]], {i, 0, 200}] (* Peter Luschny, Jun 01 2011 *)
-
PARI
a(n) = 2^valuation(n+1, 2)-1; \\ Michel Marcus, Nov 19 2017
-
PARI
a(n) = bitand(bitneg(n+1), n); \\ Ruud H.G. van Tol, Apr 05 2023
-
Python
def A135481(n): return ~(n+1)&n # Chai Wah Wu, Jul 06 2022
Formula
a(n) = A006519(n+1) - 1. - R. J. Mathar, Feb 10 2016
Extensions
a(0) = 0 prepended by Andrey Zabolotskiy, Oct 08 2019, based on Lothar Esser's contribution
A204987 Least k such that n divides 2^k - 2^j for some j satisfying 1 <= j < k.
2, 2, 3, 3, 5, 3, 4, 4, 7, 5, 11, 4, 13, 4, 5, 5, 9, 7, 19, 6, 7, 11, 12, 5, 21, 13, 19, 5, 29, 5, 6, 6, 11, 9, 13, 8, 37, 19, 13, 7, 21, 7, 15, 12, 13, 12, 24, 6, 22, 21, 9, 14, 53, 19, 21, 6, 19, 29, 59, 6, 61, 6, 7, 7, 13, 11, 67, 10, 23, 13, 36, 9, 10, 37, 21, 20, 31, 13, 40, 8, 55, 21, 83, 8, 9, 15, 29, 13
Offset: 1
Keywords
Comments
See A204892 for a discussion and guide to related sequences.
Examples
1 divides 2^2 - 2^1, so a(1)=2; 2 divides 2^2 - 2^1, so a(2)=2; 3 divides 2^3 - 2^1, so a(3)=3; 4 divides 2^3 - 2^2, so a(4)=3; 5 divides 2^5 - 2^1, so a(5)=5.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..6556
Programs
-
Mathematica
s[n_] := s[n] = 2^n; z1 = 1000; z2 = 50; Table[s[n], {n, 1, 30}] (* A000079 *) u[m_] := u[m] = Flatten[Table[s[k] - s[j], {k, 2, z1}, {j, 1, k - 1}]][[m]] Table[u[m], {m, 1, z1}] (* A204985 *) v[n_, h_] := v[n, h] = If[IntegerQ[u[h]/n], h, 0] w[n_] := w[n] = Table[v[n, h], {h, 1, z1}] d[n_] := d[n] = First[Delete[w[n], Position[w[n], 0]]] Table[d[n], {n, 1, z2}] (* A204986 *) k[n_] := k[n] = Floor[(3 + Sqrt[8 d[n] - 1])/2] m[n_] := m[n] = Floor[(-1 + Sqrt[8 n - 7])/2] j[n_] := j[n] = d[n] - m[d[n]] (m[d[n]] + 1)/2 Table[k[n], {n, 1, z2}] (* A204987 *) Table[j[n], {n, 1, z2}] (* A204988 *) Table[s[k[n]], {n, 1, z2}] (* A204989 *) Table[s[j[n]], {n, 1, z2}] (* A140670 ? *) Table[s[k[n]] - s[j[n]], {n, 1, z2}] (* A204991 *) Table[(s[k[n]] - s[j[n]])/n, {n, 1, z2}] (* A204992 *) %%/2 (* A204990=(1/2)*A204991 *)
-
PARI
A204987etA204988(n) = { my(k=2); while(1,for(j=1,k-1,if(!(((2^k)-(2^j))%n),return([k,j]))); k++); }; \\ (Computes also A204988 at the same time) - Antti Karttunen, Nov 19 2017
-
PARI
a(n)={my(k=valuation(n,2)); max(k, 1) + znorder(Mod(2, n>>k))} \\ Andrew Howroyd, Aug 08 2018
Formula
Extensions
More terms from Antti Karttunen, Nov 19 2017
A160467 a(n) = 1 if n is odd; otherwise, a(n) = 2^(k-1) where 2^k is the largest power of 2 that divides n.
1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 8, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 8, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 32, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 8, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 16
Offset: 1
Comments
From Peter Luschny, May 31 2009: (Start)
Let odd(n) be the characteristic function of the odd numbers (A000035) and sigma(n) the number of 1's in binary expansion of n (A000120). Then a(n) = 2^(sigma(n-1) - sigma(n) + odd(n)).
Let B_{n} be the Bernoulli number. Then this sequence is also
a(n) = denominator(4*(4^n-1)*B_{2*n}/n). (End)
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16384
Programs
-
Maple
nmax:=96: p:= floor(log[2](nmax)): for n from 1 to nmax do a(n):=1 end do: for q from 1 to p do for n from 1 to nmax do if n mod 2^q = 0 then a(n):= 2^(q-1) end if: end do: end do: seq(a(n), n=1..nmax); From Peter Luschny, May 31 2009: (Start) a := proc(n) local sigma; sigma := proc(n) local i; add(i,i=convert(n,base,2)) end; 2^(sigma(n-1)-sigma(n)+`if`(type(n,odd),1,0)) end: seq(a(n), n=1..96); a := proc(n) denom(4*(4^n-1)*bernoulli(2*n)/n) end: seq(a(n), n=1..96); (End)
-
Mathematica
a[n_] := If[OddQ[n], 1, 2^(IntegerExponent[n, 2] - 1)]; Array[a, 100] (* Amiram Eldar, Jul 02 2020 *)
-
PARI
A160467(n) = 2^max(valuation(n,2)-1,0); \\ Antti Karttunen, Nov 18 2017, after Max Alekseyev's Feb 09 2011 formula.
-
Python
def A160467(n): return max(1,(n&-n)>>1) # Chai Wah Wu, Jul 08 2022
Formula
a(n) = 2^max(A007814(n) - 1, 0). - Max Alekseyev, Feb 09 2011
a((2*n-1)*2^p) = A011782(p), p >= 0 and n >= 1. - Johannes W. Meijer, Jan 25 2013
a(n) = (1 + A140670(n))/2. - Antti Karttunen, Nov 18 2017
From Amiram Eldar, Dec 31 2022: (Start)
Dirichlet g.f.: zeta(s)*(2^s-2+1/2^s)/(2^s-2).
Sum_{k=1..n} a(k) ~ (1/(4*log(2)))*n*log(n) + (5/8 + (gamma-1)/(4*log(2)))*n, where gamma is Euler's constant (A001620). (End)
a(n) = A006519(n)/gcd(n,2). - Ridouane Oudra, Feb 08 2025
Extensions
Keyword mult added by Max Alekseyev, Feb 09 2011
Name changed by Antti Karttunen, Nov 18 2017
A330569 a(n) = 1 if n is odd, otherwise a(n) = 2^(v-1)+1 where v is the 2-adic valuation of n (A007814(n)).
1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 17, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 33, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1
Offset: 1
Comments
Conjecture: a(n) is the height of the bottom region in column n of the Conant gasket in A328078.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := If[OddQ[n], 1, 1 + 2^(IntegerExponent[n, 2] - 1)]; Array[a, 100] (* Amiram Eldar, Aug 30 2024 *)
-
PARI
a(n) = if(n % 2, 1, 1 + 1 << (valuation(n, 2) - 1)); \\ Amiram Eldar, Aug 30 2024
-
Python
def A330569(n): return 1+(0 if n&1 else 1<<(~n & n-1).bit_length()-1) # Chai Wah Wu, Jul 01 2022
Comments
Examples
Links
Crossrefs
Programs
Mathematica
PARI