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!)
A261338 Primes p such that digitsum(p) > digitsum(q) where q is the next prime after p. 1

%I #18 Sep 08 2022 08:46:13

%S 7,19,29,37,47,59,67,79,89,97,109,127,149,157,167,179,199,229,239,257,

%T 269,277,293,307,317,349,359,367,379,389,397,419,439,449,457,479,487,

%U 499,509,557,569,587,599,607,619,647,659,677,683,691,719,727,739,743,757

%N Primes p such that digitsum(p) > digitsum(q) where q is the next prime after p.

%C A000040(n) for n such that A007605(n) > A007605(n+1). - _Robert Israel_, Aug 17 2015

%H K. D. Bajpai, <a href="/A261338/b261338.txt">Table of n, a(n) for n = 1..10000</a>

%e 19 is in the sequence because it is prime; [digitsum(19) = 1 + 9 = 10] > [digitsum(23) = 2 + 3 = 5] where 19 and 23 are consecutive primes.

%e 47 is in the sequence because it is prime; [digitsum(47) = 4 + 7 = 11] > [digitsum(53) = 5 + 3 = 8] where 47 and 53 are consecutive primes.

%p with(numtheory): A261338:= proc() local k, k1, p; p:=ithprime(n); k:=(add(d, d=convert(p, base, 10))); k1:=(add(d, d=convert(nextprime(p), base, 10))); if k > k1 then RETURN (p); fi; end: seq(A261338 (), n=1..300);

%t A261338 = {}; Do[p = Prime[n]; k = Plus @@ IntegerDigits[p]; k1 = Plus @@ IntegerDigits[NextPrime[p]]; If[k > k1, AppendTo[A261338, p]], {n, 1, 300}]; A261338 (* Bajpai *)

%t Prime[Select[Range[100], (Plus@@IntegerDigits[Prime[#]]) >

%t (Plus@@IntegerDigits[Prime[# + 1]]) &] (* _Alonso del Arte_, Aug 16 2015 *)

%t Prime[#]&/@SequencePosition[Table[Total[IntegerDigits[p]],{p,Prime[Range[ 150]]}],_?(#[[1]]>#[[2]]&)][[All,1]]//Quiet (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Oct 10 2020 *)

%o (PARI) forprime(p = 1,300, q=nextprime(p+1); if(sumdigits(p) > sumdigits(q), print1(p,", ")));

%o (Magma) [NthPrime(n) : n in [1..200] | &+Intseq(NthPrime(n)) ge &+Intseq(NthPrime(n+1))];

%Y Cf. A000040, A007605.

%K nonn,base

%O 1,1

%A _K. D. Bajpai_, Aug 15 2015

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 May 1 05:31 EDT 2024. Contains 372148 sequences. (Running on oeis4.)