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.

A256787 Smallest odd number k such that k*2^(2*n+1)+1 is a prime number.

This page as a plain text file.
%I A256787 #26 Jun 03 2015 01:57:35
%S A256787 1,5,3,5,15,9,5,5,9,11,11,45,5,15,23,35,9,59,15,5,3,9,35,27,23,17,51,
%T A256787 5,29,27,53,9,9,9,23,39,23,5,29,249,9,51,5,75,51,117,29,77,131,219,
%U A256787 221,29,53,105,321,95,179,197,101,51,81,101,11,5,21,221,53
%N A256787 Smallest odd number k such that k*2^(2*n+1)+1 is a prime number.
%C A256787 As N increases, (Sum_{n=1..N} a(n))/(Sum_{n=1..N} n) appears to tend to log(2), as can be seen by plotting the first 10000 terms.
%C A256787 This observation is consistent with the prime number theorem as the probability that k*2^n+1 is prime is 1/(n*log(2)+log(k)) so ~ 1/(n*log(2)) as n increases, if k ~ n*log(2) then k/(n*log(2)) ~ 1.
%H A256787 Pierre CAMI, <a href="/A256787/b256787.txt">Table of n, a(n) for n = 0..10000</a>
%e A256787 1*2^(2*0+1)+1=3 is prime, so a(0)=1.
%e A256787 1*2^(2*1+1)+1=9 and 3*2^(2*1+1)+1=25 are composite, 5*2^(2*1+1)+1=41 is prime, so a(1)=5.
%p A256787 for n from 0 to 100 do
%p A256787 R:= 2^(2*n+1);
%p A256787 for k from 1 by 2 do
%p A256787    if isprime(k*R+1) then A[n]:= k; break fi
%p A256787 od:
%p A256787 od:
%p A256787 seq(A[n],n=0..100); # _Robert Israel_, Apr 24 2015
%t A256787 f[n_] := Block[{g, i, k}, g[x_, y_] := y*2^(2*x + 1) + 1; Reap@ For[i = 0, i <= n, i++, k = 1; While[Nand[PrimeQ[g[i, k]] == True, OddQ@ k], k++]; Sow@ k] // Flatten // Rest]; f@ 66 (* _Michael De Vlieger_, Apr 18 2015 *)
%o A256787 (PFGW & SCRIPT)
%o A256787 SCRIPT
%o A256787 DIM i
%o A256787 DIM n,-1
%o A256787 DIMS t
%o A256787 OPENFILEOUT myf,a(n).txt
%o A256787 LABEL loop1
%o A256787 SET n,n+2
%o A256787 SET i,-1
%o A256787 LABEL loop2
%o A256787 SET i,i+2
%o A256787 SETS t,%d,%d\,;n;i
%o A256787 PRP i*2^n+1,t
%o A256787 IF ISPRP THEN GOTO a
%o A256787 GOTO loop2
%o A256787 LABEL a
%o A256787 WRITE myf,t
%o A256787 GOTO loop1
%o A256787 (PARI) vector(100, n, n--; k=1; while(!isprime(k*2^(2*n+1)+1), k+=2); k) \\ _Colin Barker_, Apr 10 2015
%K A256787 nonn
%O A256787 0,2
%A A256787 _Pierre CAMI_, Apr 10 2015