

A098103


Consider the succession of single digits of the primes (A000040): 2 3 5 7 1 1 1 3 1 7 1 9 2 3 2 9 3 1 ... (A033308). This sequence is the lexicographically earliest derangement of A000040 that produces the same succession of digits.


2



23, 5, 7, 11, 13, 17, 19, 2, 3, 293, 137, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 1371391491511, 571, 631, 67173179181191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Derangement here means a(n) != A000040(n) for all n.
Original name: "Write each prime number >0 on a single label. Put the labels in numerical order to form an infinite sequence L. Consider the succession of single digits of L: 2 3 5 7 1 1 1 3 1 7 1 9 2 3 2 9 3 1 3 7 4 1 4 3 4 7 5 3 5 9 6 1 6 7 7 1 7 3 7 9... (see A033308). The sequence S gives a rearrangement of the labels that reproduces the same succession of digits, subject to the constraints that a label of L cannot represent itself, and the smallest label must be used that does not lead to a contradiction."
This could be roughly rephrased like this: "Rewrite in the most economical way the 'prime numbers pattern' using only prime numbers, but rearranged. Do not use any prime more than once."
a(180) has over 1000 digits.  Danny Rorabaugh, Nov 29 2015


LINKS

Danny Rorabaugh, Table of n, a(n) for n = 1..179
Eric Angelini, Sequence rewriting
Eric Angelini, Sequence rewriting [Cached copy, with permission]


EXAMPLE

We must begin with "2,3,5,7,11,..." and we cannot have the first term be 2, the first prime, so the smallest available prime is 23.


MATHEMATICA

f[lst_List, k_] := Block[{L = lst, g, a = {}, m = 0}, g[] := {Set[m, First@ FromDigits@ Append[IntegerDigits@ m, First@ #]], Set[L, Last@ #]} &@ TakeDrop[L, 1]; Do[g[]; While[Or[m == Prime[Length@ a + 1], ! PrimeQ@ m, MemberQ[a, m]], g[]]; AppendTo[a, m]; m = 0, {k}]; a]; f[Flatten@ Map[IntegerDigits, Prime@ Range@ 120], 53] (* Michael De Vlieger, Nov 29 2015, Version 10.2 *)


PROG

(Sage)
def A098103(n):
Pr, p, s, A, i = Primes(), 2, "", [], 1
while len(A)<n:
while len(s)<=i: s, p = s+str(p), next_prime(p)
q = int(s[:i])
if s[i]!="0" and is_prime(q) and Pr.unrank(len(A))!=q and (q not in A):
A.append(q)
s, i = s[i:], 1
else: i += 1
return A
A098103(179) # Danny Rorabaugh, Nov 29 2015


CROSSREFS

For other sequences of this type, cf. A098067.
Sequence in context: A255898 A281923 A040514 * A182919 A040512 A158514
Adjacent sequences: A098100 A098101 A098102 * A098104 A098105 A098106


KEYWORD

base,nice,nonn


AUTHOR

Eric Angelini, Sep 22 2004


EXTENSIONS

Name, Comments, and Example edited by Danny Rorabaugh, Nov 28 2015
Corrected and extended by Danny Rorabaugh, Nov 29 2015


STATUS

approved



