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.

A343591 Smoothly undulating alternating primes.

This page as a plain text file.
%I A343591 #55 Nov 13 2023 07:50:57
%S A343591 2,3,5,7,23,29,41,43,47,61,67,83,89,101,181,383,727,787,929,18181,
%T A343591 32323,72727,74747,78787,94949,1212121,1616161,323232323,383838383,
%U A343591 727272727,929292929,989898989,12121212121,14141414141,32323232323,383838383838383,38383838383838383,72727272727272727
%N A343591 Smoothly undulating alternating primes.
%C A343591 Equivalently, numbers that are primes, smoothly undulating = in which the digits alternate: ababab... with a <> b (A032758) and alternating = in which parity of the digits alternates (A030144).
%C A343591 Charles W. Trigg was the first to use the word 'smoothly' for these integers.
%C A343591 If we note a(ba) the terms where the substring (ba) is repeated in their decimal expansion, there exist only 16 possibilities with a odd <> 5 and b even <> 0 to get such primes. Indeed, there exist primes of the form 1(21), 1(41), 1(61), 1(81), 3(23), 3(83), 7(27), 7(47), 7(87), 9(29), 9(49), 9(89). There do not exist terms of the form 3(63), 7(67), 9(69), as they are always composite.
%C A343591 Now, what about possible terms of the form 3(43)? If (43) is repeated 3k times, 3(43) is divisible by 3; if (43) is repeated 3k+1 times, 3(43) is divisible by 7; so if such a prime exists, then the substring (43) must be repeated 3k+2 times, but it is not known if such smoothly undulating prime 3(43) exists and if it exists, (43) must be repeated at least 9302 times, so k >= 3100 (link).
%C A343591 Some properties:
%C A343591 -> Every term has two digits or an odd number of digits.
%C A343591 -> All terms with an odd number of digits are palindromic (A059758).
%C A343591 -> Only 2 and the nine 2-digit terms begin with an even digit.
%D A343591 Charles W. Trigg, Special Palindromic Primes, Journal of Recreational Mathematics, 4 (July 1971) 169-170.
%H A343591 Robert Israel, <a href="/A343591/b343591.txt">Table of n, a(n) for n = 1..69</a>
%H A343591 Mathematics Stack Exchange, <a href="https://math.stackexchange.com/questions/1159434/unsolved-in-this-infinite-sequence-no-term-is-a-prime-prove-disprove">(Unsolved) In this infinite sequence, no term is a prime: prove/disprove</a>.
%e A343591 1616161 is a term as it is prime and the digits 1 and 6 have odd and even parity and alternate.
%p A343591 f:= proc(n) local i,a,b,c,d;
%p A343591   c:= add(10^i,i=1..n-1,2);
%p A343591   d:= add(10^i,i=0..n-1,2);
%p A343591   if n = 2 then op(select(isprime,[seq(seq(a*c+b*d, b=[1,3,7,9]),a=[2,4,6,8])]))
%p A343591     else op(select(isprime, [seq(seq(a*c+b*d, a=[0,2,4,6,8]),b=[1,3,7,9])]))
%p A343591   fi
%p A343591 end proc:
%p A343591 f(1):= (2,3,5,7):
%p A343591 map(f, [1,2,seq(i,i=3..17,2)]); # _Robert Israel_, Nov 09 2023
%t A343591 f[o_,e_,n_,m_] := FromDigits @ Riffle[ConstantArray[o,n], ConstantArray[e,n-m]]; seq[n_,m_] := Module[{o = Range[1,9,2], e = Range[0,8,2]}, Select[Union[f @@@ Join[Tuples[{o, e, {n}, {m}}], Tuples[{Rest @ e, o, {n}, {m}}]]], PrimeQ]]; s = seq[1, 1]; Do[s = Join[s, seq[m, Boole[m > 1]]], {m, 1, 10}]; s (* _Amiram Eldar_, Apr 21 2021 *)
%o A343591 (Python)
%o A343591 from sympy import isprime
%o A343591 def agenthru(maxdigits):
%o A343591   if maxdigits >= 1: yield from [2, 3, 5, 7]
%o A343591   for digits in [2]*(maxdigits >= 2) + list(range(3, maxdigits+1, 2)):
%o A343591     hlf, odd = (digits+1)//2, digits%2
%o A343591     d1range = "1379" if digits%2 == 1 else "123456789"
%o A343591     d2range = "1379" if digits%2 == 0 else "0123456789"
%o A343591     for d1 in d1range:
%o A343591       for d2 in d2range:
%o A343591         if int(d1)%2 == int(d2)%2: continue
%o A343591         t = int("".join([*sum(zip(d1*hlf, d2*(digits-hlf)), ())]+[d1*odd]))
%o A343591         if isprime(t): yield t
%o A343591 print([p for p in agenthru(17)]) # _Michael S. Branicky_, Apr 21 2021
%Y A343591 Intersection of A030144 and A032758.
%Y A343591 Subsequence of A343590.
%Y A343591 Cf. A059758, A242541.
%K A343591 nonn,base
%O A343591 1,1
%A A343591 _Bernard Schott_, Apr 21 2021