An elegant way to define a sequence












4












$begingroup$


I am trying to define a sequence.
The first few terms of the sequence are:



$2,5,13,43,61$



Not yet found other terms because I am working with paper and pen, no software.



Why the first term is $5$?



Let be $pi(x)$ the celebrated prime counting function.
Well 5-$pi(5)$=$5-3$=2 which is a prime.
If we repeat the same thing with the new prime $2$, we have 2-$pi(2)=1$, which is not a prime. So starting the sequence from prime $5$, we have the cycle $5rightarrow 2rightarrow 1$. The arrows stop when a not prime is reached. No prime below $5$ has a longer cycle. Infact starting for example from $3$ you get $3-pi(3)=1$, which is not prime so the cycle is simply $3rightarrow 1$.
The second term of the sequence is $13$ because below $13$ no other prime has a larger cycle. Infact $13-pi(13)=7$, which is prime. Then $7-pi(7)=3$, which is prime and eventually $3-pi(3)=1$, which is not prime. So the cycle is $13rightarrow 7rightarrow 3rightarrow 1$



The cycle for 43 is longer so it is the third term of the above sequence.
Could you suggest to me a nice and elegant definition for this sequence: $5,13,43,61...$ (I don't know if it is infinite)
Could you find other terms with Pari if you want?










share|cite|improve this question











$endgroup$












  • $begingroup$
    @Barry Cipra any idea?
    $endgroup$
    – homunculus
    Apr 1 at 14:12










  • $begingroup$
    oeis.org/A147259
    $endgroup$
    – Don Thousand
    Apr 1 at 14:12










  • $begingroup$
    @Don Thousand are you sure is that?
    $endgroup$
    – homunculus
    Apr 1 at 14:15






  • 1




    $begingroup$
    The next terms in the sequence are $14897$ and $377942237 $.
    $endgroup$
    – Chip Hurst
    Apr 1 at 18:59






  • 2




    $begingroup$
    Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 21:31
















4












$begingroup$


I am trying to define a sequence.
The first few terms of the sequence are:



$2,5,13,43,61$



Not yet found other terms because I am working with paper and pen, no software.



Why the first term is $5$?



Let be $pi(x)$ the celebrated prime counting function.
Well 5-$pi(5)$=$5-3$=2 which is a prime.
If we repeat the same thing with the new prime $2$, we have 2-$pi(2)=1$, which is not a prime. So starting the sequence from prime $5$, we have the cycle $5rightarrow 2rightarrow 1$. The arrows stop when a not prime is reached. No prime below $5$ has a longer cycle. Infact starting for example from $3$ you get $3-pi(3)=1$, which is not prime so the cycle is simply $3rightarrow 1$.
The second term of the sequence is $13$ because below $13$ no other prime has a larger cycle. Infact $13-pi(13)=7$, which is prime. Then $7-pi(7)=3$, which is prime and eventually $3-pi(3)=1$, which is not prime. So the cycle is $13rightarrow 7rightarrow 3rightarrow 1$



The cycle for 43 is longer so it is the third term of the above sequence.
Could you suggest to me a nice and elegant definition for this sequence: $5,13,43,61...$ (I don't know if it is infinite)
Could you find other terms with Pari if you want?










share|cite|improve this question











$endgroup$












  • $begingroup$
    @Barry Cipra any idea?
    $endgroup$
    – homunculus
    Apr 1 at 14:12










  • $begingroup$
    oeis.org/A147259
    $endgroup$
    – Don Thousand
    Apr 1 at 14:12










  • $begingroup$
    @Don Thousand are you sure is that?
    $endgroup$
    – homunculus
    Apr 1 at 14:15






  • 1




    $begingroup$
    The next terms in the sequence are $14897$ and $377942237 $.
    $endgroup$
    – Chip Hurst
    Apr 1 at 18:59






  • 2




    $begingroup$
    Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 21:31














4












4








4


1



$begingroup$


I am trying to define a sequence.
The first few terms of the sequence are:



$2,5,13,43,61$



Not yet found other terms because I am working with paper and pen, no software.



Why the first term is $5$?



Let be $pi(x)$ the celebrated prime counting function.
Well 5-$pi(5)$=$5-3$=2 which is a prime.
If we repeat the same thing with the new prime $2$, we have 2-$pi(2)=1$, which is not a prime. So starting the sequence from prime $5$, we have the cycle $5rightarrow 2rightarrow 1$. The arrows stop when a not prime is reached. No prime below $5$ has a longer cycle. Infact starting for example from $3$ you get $3-pi(3)=1$, which is not prime so the cycle is simply $3rightarrow 1$.
The second term of the sequence is $13$ because below $13$ no other prime has a larger cycle. Infact $13-pi(13)=7$, which is prime. Then $7-pi(7)=3$, which is prime and eventually $3-pi(3)=1$, which is not prime. So the cycle is $13rightarrow 7rightarrow 3rightarrow 1$



The cycle for 43 is longer so it is the third term of the above sequence.
Could you suggest to me a nice and elegant definition for this sequence: $5,13,43,61...$ (I don't know if it is infinite)
Could you find other terms with Pari if you want?










share|cite|improve this question











$endgroup$




I am trying to define a sequence.
The first few terms of the sequence are:



$2,5,13,43,61$



Not yet found other terms because I am working with paper and pen, no software.



Why the first term is $5$?



Let be $pi(x)$ the celebrated prime counting function.
Well 5-$pi(5)$=$5-3$=2 which is a prime.
If we repeat the same thing with the new prime $2$, we have 2-$pi(2)=1$, which is not a prime. So starting the sequence from prime $5$, we have the cycle $5rightarrow 2rightarrow 1$. The arrows stop when a not prime is reached. No prime below $5$ has a longer cycle. Infact starting for example from $3$ you get $3-pi(3)=1$, which is not prime so the cycle is simply $3rightarrow 1$.
The second term of the sequence is $13$ because below $13$ no other prime has a larger cycle. Infact $13-pi(13)=7$, which is prime. Then $7-pi(7)=3$, which is prime and eventually $3-pi(3)=1$, which is not prime. So the cycle is $13rightarrow 7rightarrow 3rightarrow 1$



The cycle for 43 is longer so it is the third term of the above sequence.
Could you suggest to me a nice and elegant definition for this sequence: $5,13,43,61...$ (I don't know if it is infinite)
Could you find other terms with Pari if you want?







number-theory






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Apr 1 at 20:29







homunculus

















asked Apr 1 at 13:52









homunculushomunculus

1779




1779












  • $begingroup$
    @Barry Cipra any idea?
    $endgroup$
    – homunculus
    Apr 1 at 14:12










  • $begingroup$
    oeis.org/A147259
    $endgroup$
    – Don Thousand
    Apr 1 at 14:12










  • $begingroup$
    @Don Thousand are you sure is that?
    $endgroup$
    – homunculus
    Apr 1 at 14:15






  • 1




    $begingroup$
    The next terms in the sequence are $14897$ and $377942237 $.
    $endgroup$
    – Chip Hurst
    Apr 1 at 18:59






  • 2




    $begingroup$
    Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 21:31


















  • $begingroup$
    @Barry Cipra any idea?
    $endgroup$
    – homunculus
    Apr 1 at 14:12










  • $begingroup$
    oeis.org/A147259
    $endgroup$
    – Don Thousand
    Apr 1 at 14:12










  • $begingroup$
    @Don Thousand are you sure is that?
    $endgroup$
    – homunculus
    Apr 1 at 14:15






  • 1




    $begingroup$
    The next terms in the sequence are $14897$ and $377942237 $.
    $endgroup$
    – Chip Hurst
    Apr 1 at 18:59






  • 2




    $begingroup$
    Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 21:31
















$begingroup$
@Barry Cipra any idea?
$endgroup$
– homunculus
Apr 1 at 14:12




$begingroup$
@Barry Cipra any idea?
$endgroup$
– homunculus
Apr 1 at 14:12












$begingroup$
oeis.org/A147259
$endgroup$
– Don Thousand
Apr 1 at 14:12




$begingroup$
oeis.org/A147259
$endgroup$
– Don Thousand
Apr 1 at 14:12












$begingroup$
@Don Thousand are you sure is that?
$endgroup$
– homunculus
Apr 1 at 14:15




$begingroup$
@Don Thousand are you sure is that?
$endgroup$
– homunculus
Apr 1 at 14:15




1




1




$begingroup$
The next terms in the sequence are $14897$ and $377942237 $.
$endgroup$
– Chip Hurst
Apr 1 at 18:59




$begingroup$
The next terms in the sequence are $14897$ and $377942237 $.
$endgroup$
– Chip Hurst
Apr 1 at 18:59




2




2




$begingroup$
Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
$endgroup$
– Jeppe Stig Nielsen
Apr 1 at 21:31




$begingroup$
Chip Hurst record goes like this: $$377942237 mapsto 357721207 mapsto 338525531 mapsto 320305991 mapsto 303015169 mapsto 286608383 mapsto 271043027 mapsto 256278002$$
$endgroup$
– Jeppe Stig Nielsen
Apr 1 at 21:31










3 Answers
3






active

oldest

votes


















5












$begingroup$

I believe your sequence continues forever but grows quickly. If $n$ is large, the density of primes around $n$ is $log n$. Since $log n$ is so much smaller than $n$, the chance a random $n$ has $k$ arrows is about $frac 1{(log n)^{k+1}}$. The expected number of sequences of length $k$ above $10^{12},$ say, is then $int_{10^{12}}^infty frac {dn}{(log n)^{k+1}}$. This diverges because $(log n)^k$ becomes less than $n$ for $n$ large enough and we know the integral of $frac 1n$ diverges. Each subtraction is only of order $frac n{log n}$, which is small compared to $n$ and the log will not change much.



If we ask what length of sequence we expect to find among the $12$ digit numbers, we note that the log of these numbers is about $29$ and that $29^{8.5} approx 3cdot 10^{12}$. We would expect to find some sequences of $7$ arrows, maybe $8$ or $9$, and be surprised at $10$ or more. For $100$ digit numbers, the log is about $231$ and $231^{42.5} approx 3cdot 10^{100}$, so we would expect some sequences of length $40$ or $41$ among the $100$ digit numbers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
    $endgroup$
    – homunculus
    Apr 1 at 14:53












  • $begingroup$
    You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
    $endgroup$
    – Ross Millikan
    Apr 1 at 15:05










  • $begingroup$
    only even indexed primes after the first entry.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 16:24










  • $begingroup$
    @Ross Millikan but not all primes p ends the sequence with 1, isn't?
    $endgroup$
    – homunculus
    Apr 1 at 21:28










  • $begingroup$
    Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 22:21



















2












$begingroup$

`my(a=0,b=0);forprime(x=1,50000,y=x;while(isprime(y-primepi(y)),y-=primepi(y);b++);if(b>a,a=b;print(x));b=0)`


produces 14897 as the next one. Then no more below 500000. There's not too much to say except primes in the sequence will be primes at even indices after the first, simply because most primes are more than 2 away from their indices.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This supports my claim that they will grow rapidly. Thanks
    $endgroup$
    – Ross Millikan
    Apr 1 at 16:37










  • $begingroup$
    can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:03










  • $begingroup$
    I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
    $endgroup$
    – Paul Sinclair
    Apr 1 at 17:06










  • $begingroup$
    The later (in fact tried as high as 700,000) but only after posting the code.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:09



















2












$begingroup$

Using $S$ to denote the sequence you're trying to define, one may do so in
terms of two auxiliary functions $N$ and $L$, where $N$ assigns to every prime number $x$ a sequence whose first term, denoted by $(N(x))(0)$$^*$, is $x$ itself, and each next term, denoted by $(N(x))(n + 1)$, is given by $(N(x))(n) - pi((N(x))(n))$, and $L$ is the function which gives the number of terms of a sequence returned by $N$ up to when the first non-prime term is reached. $S$ is then defined to be such that the first term equals $5$, and given any term $S(n)$, the next term in the sequence is then the smallest prime number $p$ such that $L(N(p)) > L(N(S(n)))$.



In formula:



$S(0) = 5$
$S(n + 1) = langledownarrow p : p in mathbb{P} : L(N(p)) > L(N(S(n)))rangle$



$(N(x))(0) = x$
$(N(x))(n + 1) = (N(x))(n) - pi((N(x))(n))$



$L(N(x)) = langledownarrow n : n in mathbb{N} : (N(x))(n) notin
mathbb{P}rangle$



The notation $langledownarrow x : R(x) : T(x)rangle$ here denotes the minimum element $x$ that satisfies $T(x)$ from the set of all elements satisfying $R(x)$. $R(x)$ and $T(x)$ denote arbitrary predicates (i. e. boolean-valued functions) which generally depend on $x$.





$^*$Note: Here we use the definition that a sequence is any function whose domain consists of either all natural numbers or all natural numbers $n$ such that $0 le n lt m$ for arbitrary natural constant $m$. We admit $0$ as the smallest natural number.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
    $endgroup$
    – lucasb
    Apr 3 at 0:55












Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3170629%2fan-elegant-way-to-define-a-sequence%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









5












$begingroup$

I believe your sequence continues forever but grows quickly. If $n$ is large, the density of primes around $n$ is $log n$. Since $log n$ is so much smaller than $n$, the chance a random $n$ has $k$ arrows is about $frac 1{(log n)^{k+1}}$. The expected number of sequences of length $k$ above $10^{12},$ say, is then $int_{10^{12}}^infty frac {dn}{(log n)^{k+1}}$. This diverges because $(log n)^k$ becomes less than $n$ for $n$ large enough and we know the integral of $frac 1n$ diverges. Each subtraction is only of order $frac n{log n}$, which is small compared to $n$ and the log will not change much.



If we ask what length of sequence we expect to find among the $12$ digit numbers, we note that the log of these numbers is about $29$ and that $29^{8.5} approx 3cdot 10^{12}$. We would expect to find some sequences of $7$ arrows, maybe $8$ or $9$, and be surprised at $10$ or more. For $100$ digit numbers, the log is about $231$ and $231^{42.5} approx 3cdot 10^{100}$, so we would expect some sequences of length $40$ or $41$ among the $100$ digit numbers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
    $endgroup$
    – homunculus
    Apr 1 at 14:53












  • $begingroup$
    You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
    $endgroup$
    – Ross Millikan
    Apr 1 at 15:05










  • $begingroup$
    only even indexed primes after the first entry.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 16:24










  • $begingroup$
    @Ross Millikan but not all primes p ends the sequence with 1, isn't?
    $endgroup$
    – homunculus
    Apr 1 at 21:28










  • $begingroup$
    Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 22:21
















5












$begingroup$

I believe your sequence continues forever but grows quickly. If $n$ is large, the density of primes around $n$ is $log n$. Since $log n$ is so much smaller than $n$, the chance a random $n$ has $k$ arrows is about $frac 1{(log n)^{k+1}}$. The expected number of sequences of length $k$ above $10^{12},$ say, is then $int_{10^{12}}^infty frac {dn}{(log n)^{k+1}}$. This diverges because $(log n)^k$ becomes less than $n$ for $n$ large enough and we know the integral of $frac 1n$ diverges. Each subtraction is only of order $frac n{log n}$, which is small compared to $n$ and the log will not change much.



If we ask what length of sequence we expect to find among the $12$ digit numbers, we note that the log of these numbers is about $29$ and that $29^{8.5} approx 3cdot 10^{12}$. We would expect to find some sequences of $7$ arrows, maybe $8$ or $9$, and be surprised at $10$ or more. For $100$ digit numbers, the log is about $231$ and $231^{42.5} approx 3cdot 10^{100}$, so we would expect some sequences of length $40$ or $41$ among the $100$ digit numbers.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
    $endgroup$
    – homunculus
    Apr 1 at 14:53












  • $begingroup$
    You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
    $endgroup$
    – Ross Millikan
    Apr 1 at 15:05










  • $begingroup$
    only even indexed primes after the first entry.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 16:24










  • $begingroup$
    @Ross Millikan but not all primes p ends the sequence with 1, isn't?
    $endgroup$
    – homunculus
    Apr 1 at 21:28










  • $begingroup$
    Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 22:21














5












5








5





$begingroup$

I believe your sequence continues forever but grows quickly. If $n$ is large, the density of primes around $n$ is $log n$. Since $log n$ is so much smaller than $n$, the chance a random $n$ has $k$ arrows is about $frac 1{(log n)^{k+1}}$. The expected number of sequences of length $k$ above $10^{12},$ say, is then $int_{10^{12}}^infty frac {dn}{(log n)^{k+1}}$. This diverges because $(log n)^k$ becomes less than $n$ for $n$ large enough and we know the integral of $frac 1n$ diverges. Each subtraction is only of order $frac n{log n}$, which is small compared to $n$ and the log will not change much.



If we ask what length of sequence we expect to find among the $12$ digit numbers, we note that the log of these numbers is about $29$ and that $29^{8.5} approx 3cdot 10^{12}$. We would expect to find some sequences of $7$ arrows, maybe $8$ or $9$, and be surprised at $10$ or more. For $100$ digit numbers, the log is about $231$ and $231^{42.5} approx 3cdot 10^{100}$, so we would expect some sequences of length $40$ or $41$ among the $100$ digit numbers.






share|cite|improve this answer









$endgroup$



I believe your sequence continues forever but grows quickly. If $n$ is large, the density of primes around $n$ is $log n$. Since $log n$ is so much smaller than $n$, the chance a random $n$ has $k$ arrows is about $frac 1{(log n)^{k+1}}$. The expected number of sequences of length $k$ above $10^{12},$ say, is then $int_{10^{12}}^infty frac {dn}{(log n)^{k+1}}$. This diverges because $(log n)^k$ becomes less than $n$ for $n$ large enough and we know the integral of $frac 1n$ diverges. Each subtraction is only of order $frac n{log n}$, which is small compared to $n$ and the log will not change much.



If we ask what length of sequence we expect to find among the $12$ digit numbers, we note that the log of these numbers is about $29$ and that $29^{8.5} approx 3cdot 10^{12}$. We would expect to find some sequences of $7$ arrows, maybe $8$ or $9$, and be surprised at $10$ or more. For $100$ digit numbers, the log is about $231$ and $231^{42.5} approx 3cdot 10^{100}$, so we would expect some sequences of length $40$ or $41$ among the $100$ digit numbers.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Apr 1 at 14:43









Ross MillikanRoss Millikan

301k24200375




301k24200375












  • $begingroup$
    thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
    $endgroup$
    – homunculus
    Apr 1 at 14:53












  • $begingroup$
    You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
    $endgroup$
    – Ross Millikan
    Apr 1 at 15:05










  • $begingroup$
    only even indexed primes after the first entry.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 16:24










  • $begingroup$
    @Ross Millikan but not all primes p ends the sequence with 1, isn't?
    $endgroup$
    – homunculus
    Apr 1 at 21:28










  • $begingroup$
    Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 22:21


















  • $begingroup$
    thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
    $endgroup$
    – homunculus
    Apr 1 at 14:53












  • $begingroup$
    You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
    $endgroup$
    – Ross Millikan
    Apr 1 at 15:05










  • $begingroup$
    only even indexed primes after the first entry.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 16:24










  • $begingroup$
    @Ross Millikan but not all primes p ends the sequence with 1, isn't?
    $endgroup$
    – homunculus
    Apr 1 at 21:28










  • $begingroup$
    Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
    $endgroup$
    – Jeppe Stig Nielsen
    Apr 1 at 22:21
















$begingroup$
thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
$endgroup$
– homunculus
Apr 1 at 14:53






$begingroup$
thanks but a way to define the sequence? I am still thinkig about an elegant way to define it?
$endgroup$
– homunculus
Apr 1 at 14:53














$begingroup$
You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
$endgroup$
– Ross Millikan
Apr 1 at 15:05




$begingroup$
You have defined it nicely. Given $n$, see how many steps of primes you get and call it $f(n)$. Your sequence are then new maxima of $f(n)$. I strongly doubt there is a way other than searching to find the sixth or tenth term.
$endgroup$
– Ross Millikan
Apr 1 at 15:05












$begingroup$
only even indexed primes after the first entry.
$endgroup$
– Roddy MacPhee
Apr 1 at 16:24




$begingroup$
only even indexed primes after the first entry.
$endgroup$
– Roddy MacPhee
Apr 1 at 16:24












$begingroup$
@Ross Millikan but not all primes p ends the sequence with 1, isn't?
$endgroup$
– homunculus
Apr 1 at 21:28




$begingroup$
@Ross Millikan but not all primes p ends the sequence with 1, isn't?
$endgroup$
– homunculus
Apr 1 at 21:28












$begingroup$
Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
$endgroup$
– Jeppe Stig Nielsen
Apr 1 at 22:21




$begingroup$
Formally, you can define your sequence like this: Let $phi$ be given by $$phi(p)=begin{cases}p-pi(p), & text{if $p$ is prime}\ text{undefined}, & text{otherwise}end{cases}$$ For each prime $p$, let $f(p)$ denote the maximal number of times you can iterate $phi$ starting from $p$. For example $f(43)=4$ because we get the four-arrow chain $$43mapsto 29mapsto 19mapsto 11mapsto 6$$ and you cannot go on because $6$ is not prime. Then the sequence is defined as the $p$ for which $f(p)$ is record high. So a $p$ is in the sequence iff $f(p)$ is strictly greater than $f(q)$ for all $q<p$.
$endgroup$
– Jeppe Stig Nielsen
Apr 1 at 22:21











2












$begingroup$

`my(a=0,b=0);forprime(x=1,50000,y=x;while(isprime(y-primepi(y)),y-=primepi(y);b++);if(b>a,a=b;print(x));b=0)`


produces 14897 as the next one. Then no more below 500000. There's not too much to say except primes in the sequence will be primes at even indices after the first, simply because most primes are more than 2 away from their indices.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This supports my claim that they will grow rapidly. Thanks
    $endgroup$
    – Ross Millikan
    Apr 1 at 16:37










  • $begingroup$
    can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:03










  • $begingroup$
    I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
    $endgroup$
    – Paul Sinclair
    Apr 1 at 17:06










  • $begingroup$
    The later (in fact tried as high as 700,000) but only after posting the code.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:09
















2












$begingroup$

`my(a=0,b=0);forprime(x=1,50000,y=x;while(isprime(y-primepi(y)),y-=primepi(y);b++);if(b>a,a=b;print(x));b=0)`


produces 14897 as the next one. Then no more below 500000. There's not too much to say except primes in the sequence will be primes at even indices after the first, simply because most primes are more than 2 away from their indices.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    This supports my claim that they will grow rapidly. Thanks
    $endgroup$
    – Ross Millikan
    Apr 1 at 16:37










  • $begingroup$
    can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:03










  • $begingroup$
    I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
    $endgroup$
    – Paul Sinclair
    Apr 1 at 17:06










  • $begingroup$
    The later (in fact tried as high as 700,000) but only after posting the code.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:09














2












2








2





$begingroup$

`my(a=0,b=0);forprime(x=1,50000,y=x;while(isprime(y-primepi(y)),y-=primepi(y);b++);if(b>a,a=b;print(x));b=0)`


produces 14897 as the next one. Then no more below 500000. There's not too much to say except primes in the sequence will be primes at even indices after the first, simply because most primes are more than 2 away from their indices.






share|cite|improve this answer









$endgroup$



`my(a=0,b=0);forprime(x=1,50000,y=x;while(isprime(y-primepi(y)),y-=primepi(y);b++);if(b>a,a=b;print(x));b=0)`


produces 14897 as the next one. Then no more below 500000. There's not too much to say except primes in the sequence will be primes at even indices after the first, simply because most primes are more than 2 away from their indices.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Apr 1 at 15:52









Roddy MacPheeRoddy MacPhee

724118




724118












  • $begingroup$
    This supports my claim that they will grow rapidly. Thanks
    $endgroup$
    – Ross Millikan
    Apr 1 at 16:37










  • $begingroup$
    can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:03










  • $begingroup$
    I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
    $endgroup$
    – Paul Sinclair
    Apr 1 at 17:06










  • $begingroup$
    The later (in fact tried as high as 700,000) but only after posting the code.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:09


















  • $begingroup$
    This supports my claim that they will grow rapidly. Thanks
    $endgroup$
    – Ross Millikan
    Apr 1 at 16:37










  • $begingroup$
    can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:03










  • $begingroup$
    I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
    $endgroup$
    – Paul Sinclair
    Apr 1 at 17:06










  • $begingroup$
    The later (in fact tried as high as 700,000) but only after posting the code.
    $endgroup$
    – Roddy MacPhee
    Apr 1 at 17:09
















$begingroup$
This supports my claim that they will grow rapidly. Thanks
$endgroup$
– Ross Millikan
Apr 1 at 16:37




$begingroup$
This supports my claim that they will grow rapidly. Thanks
$endgroup$
– Ross Millikan
Apr 1 at 16:37












$begingroup$
can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
$endgroup$
– Roddy MacPhee
Apr 1 at 17:03




$begingroup$
can we get it to support valuation of 2 for the index ? so far they are all valuation 1. If that continues checking only every 4th prime is possible.
$endgroup$
– Roddy MacPhee
Apr 1 at 17:03












$begingroup$
I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
$endgroup$
– Paul Sinclair
Apr 1 at 17:06




$begingroup$
I note that your code has 50,000, but the text below has 500,000. Did you check it to 50,000 or 500,000?
$endgroup$
– Paul Sinclair
Apr 1 at 17:06












$begingroup$
The later (in fact tried as high as 700,000) but only after posting the code.
$endgroup$
– Roddy MacPhee
Apr 1 at 17:09




$begingroup$
The later (in fact tried as high as 700,000) but only after posting the code.
$endgroup$
– Roddy MacPhee
Apr 1 at 17:09











2












$begingroup$

Using $S$ to denote the sequence you're trying to define, one may do so in
terms of two auxiliary functions $N$ and $L$, where $N$ assigns to every prime number $x$ a sequence whose first term, denoted by $(N(x))(0)$$^*$, is $x$ itself, and each next term, denoted by $(N(x))(n + 1)$, is given by $(N(x))(n) - pi((N(x))(n))$, and $L$ is the function which gives the number of terms of a sequence returned by $N$ up to when the first non-prime term is reached. $S$ is then defined to be such that the first term equals $5$, and given any term $S(n)$, the next term in the sequence is then the smallest prime number $p$ such that $L(N(p)) > L(N(S(n)))$.



In formula:



$S(0) = 5$
$S(n + 1) = langledownarrow p : p in mathbb{P} : L(N(p)) > L(N(S(n)))rangle$



$(N(x))(0) = x$
$(N(x))(n + 1) = (N(x))(n) - pi((N(x))(n))$



$L(N(x)) = langledownarrow n : n in mathbb{N} : (N(x))(n) notin
mathbb{P}rangle$



The notation $langledownarrow x : R(x) : T(x)rangle$ here denotes the minimum element $x$ that satisfies $T(x)$ from the set of all elements satisfying $R(x)$. $R(x)$ and $T(x)$ denote arbitrary predicates (i. e. boolean-valued functions) which generally depend on $x$.





$^*$Note: Here we use the definition that a sequence is any function whose domain consists of either all natural numbers or all natural numbers $n$ such that $0 le n lt m$ for arbitrary natural constant $m$. We admit $0$ as the smallest natural number.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
    $endgroup$
    – lucasb
    Apr 3 at 0:55
















2












$begingroup$

Using $S$ to denote the sequence you're trying to define, one may do so in
terms of two auxiliary functions $N$ and $L$, where $N$ assigns to every prime number $x$ a sequence whose first term, denoted by $(N(x))(0)$$^*$, is $x$ itself, and each next term, denoted by $(N(x))(n + 1)$, is given by $(N(x))(n) - pi((N(x))(n))$, and $L$ is the function which gives the number of terms of a sequence returned by $N$ up to when the first non-prime term is reached. $S$ is then defined to be such that the first term equals $5$, and given any term $S(n)$, the next term in the sequence is then the smallest prime number $p$ such that $L(N(p)) > L(N(S(n)))$.



In formula:



$S(0) = 5$
$S(n + 1) = langledownarrow p : p in mathbb{P} : L(N(p)) > L(N(S(n)))rangle$



$(N(x))(0) = x$
$(N(x))(n + 1) = (N(x))(n) - pi((N(x))(n))$



$L(N(x)) = langledownarrow n : n in mathbb{N} : (N(x))(n) notin
mathbb{P}rangle$



The notation $langledownarrow x : R(x) : T(x)rangle$ here denotes the minimum element $x$ that satisfies $T(x)$ from the set of all elements satisfying $R(x)$. $R(x)$ and $T(x)$ denote arbitrary predicates (i. e. boolean-valued functions) which generally depend on $x$.





$^*$Note: Here we use the definition that a sequence is any function whose domain consists of either all natural numbers or all natural numbers $n$ such that $0 le n lt m$ for arbitrary natural constant $m$. We admit $0$ as the smallest natural number.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
    $endgroup$
    – lucasb
    Apr 3 at 0:55














2












2








2





$begingroup$

Using $S$ to denote the sequence you're trying to define, one may do so in
terms of two auxiliary functions $N$ and $L$, where $N$ assigns to every prime number $x$ a sequence whose first term, denoted by $(N(x))(0)$$^*$, is $x$ itself, and each next term, denoted by $(N(x))(n + 1)$, is given by $(N(x))(n) - pi((N(x))(n))$, and $L$ is the function which gives the number of terms of a sequence returned by $N$ up to when the first non-prime term is reached. $S$ is then defined to be such that the first term equals $5$, and given any term $S(n)$, the next term in the sequence is then the smallest prime number $p$ such that $L(N(p)) > L(N(S(n)))$.



In formula:



$S(0) = 5$
$S(n + 1) = langledownarrow p : p in mathbb{P} : L(N(p)) > L(N(S(n)))rangle$



$(N(x))(0) = x$
$(N(x))(n + 1) = (N(x))(n) - pi((N(x))(n))$



$L(N(x)) = langledownarrow n : n in mathbb{N} : (N(x))(n) notin
mathbb{P}rangle$



The notation $langledownarrow x : R(x) : T(x)rangle$ here denotes the minimum element $x$ that satisfies $T(x)$ from the set of all elements satisfying $R(x)$. $R(x)$ and $T(x)$ denote arbitrary predicates (i. e. boolean-valued functions) which generally depend on $x$.





$^*$Note: Here we use the definition that a sequence is any function whose domain consists of either all natural numbers or all natural numbers $n$ such that $0 le n lt m$ for arbitrary natural constant $m$. We admit $0$ as the smallest natural number.






share|cite|improve this answer











$endgroup$



Using $S$ to denote the sequence you're trying to define, one may do so in
terms of two auxiliary functions $N$ and $L$, where $N$ assigns to every prime number $x$ a sequence whose first term, denoted by $(N(x))(0)$$^*$, is $x$ itself, and each next term, denoted by $(N(x))(n + 1)$, is given by $(N(x))(n) - pi((N(x))(n))$, and $L$ is the function which gives the number of terms of a sequence returned by $N$ up to when the first non-prime term is reached. $S$ is then defined to be such that the first term equals $5$, and given any term $S(n)$, the next term in the sequence is then the smallest prime number $p$ such that $L(N(p)) > L(N(S(n)))$.



In formula:



$S(0) = 5$
$S(n + 1) = langledownarrow p : p in mathbb{P} : L(N(p)) > L(N(S(n)))rangle$



$(N(x))(0) = x$
$(N(x))(n + 1) = (N(x))(n) - pi((N(x))(n))$



$L(N(x)) = langledownarrow n : n in mathbb{N} : (N(x))(n) notin
mathbb{P}rangle$



The notation $langledownarrow x : R(x) : T(x)rangle$ here denotes the minimum element $x$ that satisfies $T(x)$ from the set of all elements satisfying $R(x)$. $R(x)$ and $T(x)$ denote arbitrary predicates (i. e. boolean-valued functions) which generally depend on $x$.





$^*$Note: Here we use the definition that a sequence is any function whose domain consists of either all natural numbers or all natural numbers $n$ such that $0 le n lt m$ for arbitrary natural constant $m$. We admit $0$ as the smallest natural number.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Apr 3 at 0:54

























answered Apr 1 at 21:33









lucasblucasb

213




213












  • $begingroup$
    I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
    $endgroup$
    – lucasb
    Apr 3 at 0:55


















  • $begingroup$
    I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
    $endgroup$
    – lucasb
    Apr 3 at 0:55
















$begingroup$
I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
$endgroup$
– lucasb
Apr 3 at 0:55




$begingroup$
I have edited this answer many times already, but I think I'm done now. I have performed a major clean-up on it by leaving the precise delineation of the domains and codomains of $S$, $N(x)$ and $L$ unspecified, as that degree of overspecification is completely irrelevant to the problem.
$endgroup$
– lucasb
Apr 3 at 0:55


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3170629%2fan-elegant-way-to-define-a-sequence%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...