A029810 Erroneous version of A033809, A046067.
1, 2, 1, 2, 1, 1, 2, 1, 3, 6, 1, 1, 2, 2, 1, 8, 1, 1, 2, 1, 1, 2, 2, 583, 2, 1, 1, 4, 2, 5, 4, 1
Offset: 1
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.
1*(2^0)+1=2 is prime, so a(1)=0; 3*(2^1)+1=5 is prime, so a(3)=1; For n=7, 7+1 and 7*2+1 are composite, but 7*2^2+1=29 is prime, so a(7)=2.
Do[m = 0; While[ !PrimeQ[n*2^m + 1], m++ ]; Print[m], {n, 1, 110} ] sm[n_]:=Module[{k=0},While[!PrimeQ[n 2^k+1],k++];k]; Array[sm,120] (* Harvey P. Dale, Feb 05 2020 *)
max = 10000 (* this maximum value of m is sufficient up to n = 1000 *); a[n_] := For[m = 1, m <= max, m++, If[PrimeQ[(2n - 1)*2^m + 1], Return[m]]] /. Null -> -1; a[1] = 0; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jun 08 2012 *)
N:= 1000: # to get a(1) to a(N), using k up to 10000 a[1]:= 1: for n from 2 to N do if n mod 5 = 4 then a[n]:= 0 else for k from 1 to 10000 do if isprime(n*6^k+1) then a[n]:= k; break fi od fi od: L:= [seq(a[n],n=1..N)]; # Robert Israel, Mar 17 2015
(* m <= 10000 is sufficient up to n = 1000 *) a[n_] := For[k = 1, k <= 10000, k++, If[PrimeQ[n*6^k + 1], Return[k]]] /. Null -> 0; Table[a[n], {n, 1, 120}]
a(n) = if(n%5==4, 0, for(k = 1, 10000, if(ispseudoprime(n*6^k+1), return(k))))
lst = {}; Do[k = 1; While[True, p = n*2^k + 1; If[PrimeQ[p] && IntegerQ@Log[2, MultiplicativeOrder[2, p]], AppendTo[lst, k]; Break[]]; k++], {n, 1, 9, 2}]; lst
Table starts 1 2 4 8 16 32 64 128 ... A000079 1 2 5 6 8 12 18 30 ... A002253 1 3 7 13 15 25 39 55 ... A002254 2 4 6 14 20 26 50 52 ... A032353 1 2 3 6 7 11 14 17 ... A002256 1 3 5 7 19 21 43 81 ... A002261 2 8 10 20 28 82 188 308 ... A032356 1 2 4 9 10 12 27 37 ... A002258 ... (2*39279 - 1)*2^r + 1 is composite for every r > 0 (see comments from A046067), so the 39279th row is A000004, the zero sequence.
vk(k, nn) = if (k==1, return (vector(nn, i, 2^(i-1)))); my(v = vector(nn-k+1), nb=0, i=0, x); while (nb != nn-k+1, if (isprime((2*k-1)*2^i+1), nb++; v[nb] = i); i++;); v; lista(nn) = my(v=vector(nn, k, vk(k, nn))); my(w=List()); for (i=1, nn, for (j=1, i, listput(w, v[i-j+1][j]););); Vec(w); \\ Michel Marcus, Mar 03 2023
Comments