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
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
A378992 a(n) = A011371(n) - A048881(n); The exponent of the highest power of 2 dividing the n-th factorial minus the exponent of the highest power of 2 dividing n-th Catalan number.
0, 0, 0, 1, 2, 2, 2, 4, 6, 6, 6, 7, 8, 8, 8, 11, 14, 14, 14, 15, 16, 16, 16, 18, 20, 20, 20, 21, 22, 22, 22, 26, 30, 30, 30, 31, 32, 32, 32, 34, 36, 36, 36, 37, 38, 38, 38, 41, 44, 44, 44, 45, 46, 46, 46, 48, 50, 50, 50, 51, 52, 52, 52, 57, 62, 62, 62, 63, 64, 64, 64, 66, 68, 68, 68, 69, 70, 70, 70, 73, 76, 76, 76
Offset: 0
Comments
Apparently, after the initial three 0's, only terms of A092054 occur, every other as a single copy, and every other in a batch of 3 duplicated terms.
Links
Crossrefs
Programs
-
Mathematica
A378992[n_] := n - DigitCount[n, 2, 1] - DigitCount[n + 1, 2, 1] + 1; Array[A378992, 100, 0] (* or *) MapIndexed[#2[[1]] - # &, Total[Partition[DigitCount[Range[0, 100], 2, 1], 2, 1], {2}]] (* Paolo Xausa, Dec 28 2024 *)
-
PARI
A378992(n) = (1+(n-hammingweight(n)-hammingweight(1+n)));
Comments
Examples
Links
Crossrefs
Programs
Mathematica
PARI