login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A348633 Lexicographically earliest sequence of distinct primes where the concatenation of all terms alternates a 1 digit with a not-1 digit. 1
2, 13, 17, 19, 101, 3, 131, 5, 151, 7, 181, 31, 41, 61, 71, 313, 191, 317, 1013, 1019, 1213, 1217, 1319, 1613, 1619, 1913, 10141, 419, 10151, 613, 10181, 617, 12101, 619, 12161, 719, 13121, 919, 13151, 2131, 2141, 2161, 3121, 3181, 3191, 5101, 5171, 6101, 6121, 6131, 6151, 7121, 7151, 8101, 8161, 8171, 8191, 9151, 9161, 9181, 21013, 13171, 21017, 15101 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Primes containing two adjacent ones are necessarily excluded.
LINKS
MATHEMATICA
q[p_, m_] := AllTrue[IntegerDigits[p][[m ;; -1 ;; 2]], # == 1 &] && AllTrue[IntegerDigits[p][[3 - m ;; -1 ;; 2]], # != 1 &]; seq[max_] := Module[{p = Select[Range[3, max], PrimeQ], p1, p2, s = {2}}, p1 = Select[p, q[#, 1] &]; p2 = Select[p, q[#, 2] &]; While[p1 != {} && p2 != {}, If[Mod[s[[-1]], 10] == 1, AppendTo[s, p2[[1]]]; p2 = Drop[p2, 1], AppendTo[s, p1[[1]]]; p1 = Drop[p1, 1]]]; s]; seq[2*10^4] (* Amiram Eldar, Oct 28 2021 *)
PROG
(Python)
from sympy import isprime
from itertools import product
def eo1(): # generates +ive terms with every other digit 1 and not-1 or v.v.
yield from range(1, 10)
digits = 2
while True:
for not1s in product("023456789", repeat=digits//2):
yield(int("1" + "1".join(not1s) + "1"*(digits%2)))
for first in "23456789":
for not1s in product("023456789", repeat=(digits-1)//2):
yield(int("1".join((first, )+not1s) + "1"*(digits%2==0)))
digits += 1
def aupton(terms):
alst, aset, astr = [2], {2}, "2"
kgen = {True: eo1(), False: eo1()}
for n in range(2, terms+1):
mustbegin1 = (astr[-1] != "1")
k = next(kgen[mustbegin1]); sk = str(k)
while k in aset or ((sk[0] == "1") != mustbegin1) or not isprime(k):
k = next(kgen[mustbegin1]); sk = str(k)
alst.append(k); aset.add(k); astr += sk
return alst
print(aupton(64)) # Michael S. Branicky, Oct 28 2021
CROSSREFS
Sequence in context: A038889 A152652 A142339 * A105913 A020480 A352572
KEYWORD
nonn,base
AUTHOR
Hans Havermann, Oct 26 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 23:05 EDT 2024. Contains 375284 sequences. (Running on oeis4.)