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 re-writing
Eric Angelini, Sequence re-writing [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
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