login
Strictly undulating primes (digits alternate and differ by 1).
2

%I #30 Aug 11 2024 14:41:33

%S 2,3,5,7,23,43,67,89,101,787,32323,78787,1212121,323232323,989898989,

%T 12121212121,32323232323,787878787878787878787,

%U 787878787878787878787878787,1212121212121212121212121212121212121212121

%N Strictly undulating primes (digits alternate and differ by 1).

%C The next two terms have 95 and 139 digits respectively. [_Jayanta Basu_, May 09 2013]

%D Of form ababa... with |a-b| = 1.

%D C. A. Pickover, "Keys to Infinity", Wiley 1995, pp. 159-160.

%D C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.

%H Harvey P. Dale, <a href="/A059170/b059170.txt">Table of n, a(n) for n = 1..25</a> (* All terms with less than 1000 digits. *)

%H P. De Geest, <a href="https://www.worldofnumbers.com/undulat.htm">More undulating primes</a>

%H C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," <a href="http://www.zentralblatt-math.org/zmath/en/search/?q=an:0983.00008&amp;format=complete">Zentralblatt review</a>

%t a[n_]:=DeleteDuplicates[Take[IntegerDigits[n],{1,-1,2}]]; b[n_]:=DeleteDuplicates[Take[IntegerDigits[n],{2,-1,2}]]; t={}; Do[p=Prime[n]; If[p<10, AppendTo[t,p], If[Length[a[p]] == Length[b[p]] == 1 && Abs[a[p][[1]]-b[p][[1]]] == 1, AppendTo[t,p]]], {n,10^5}]; t (* _Jayanta Basu_, May 08 2013 *)

%t t1=Join[{2,3,5,7},Select[Range[10,100],PrimeQ[#]&&Abs[Differences[IntegerDigits[#]]]=={1}&]]; Do[a=n*10+(n-1);b=(n-1)*10+n; t1=Join[t1,Select[Table[(a*10^(2*n+1)-b)/99,{n,25}],PrimeQ]]; If[n<=7,c=n*10+(n+1);d=(n+1)*10+n;t1=Join[t1,Select[Table[(c*10^(2*n+1)-d)/99,{n,25}],PrimeQ]]],{n,1,9,2}]; Sort[t1] (* _Jayanta Basu_, May 09 2013 *)

%t With[{c=Flatten[{#,Reverse[#]}&/@Table[{a,a+1},{a,0,8}],1]},Flatten[ Select[ Table[ FromDigits[PadRight[{},n,#]],{n,50}],PrimeQ]&/@c]]//Union (* _Harvey P. Dale_, Aug 20 2022 *)

%Y Cf. A032758, A059168, A048398, A033619, A046075, A059758.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Feb 14 2001

%E Extended by _Patrick De Geest_, Feb 25 2001

%E Offset corrected by _Arkadiusz Wesolowski_, Sep 13 2011