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!)
A078652 a(1)=1, a(2n)=nextprime(a(n-1)), a(2n+1)= sum of digits of all previous terms + 1. 0

%I #11 Dec 15 2017 17:36:09

%S 1,2,4,5,13,17,25,29,43,47,61,67,81,83,101,103,107,109,125,127,143,

%T 149,165,167,191,193,215,223,230,233,243,251,260,263,279,281,308,311,

%U 324,331,340,347,361,367,387,389,425,431,444,449,473,479,507,509,533,541

%N a(1)=1, a(2n)=nextprime(a(n-1)), a(2n+1)= sum of digits of all previous terms + 1.

%t lst={1};i=1;Do[If[EvenQ[n],AppendTo[lst,NextPrime[Last[lst]]],AppendTo[ lst,Total[ Flatten[ IntegerDigits/@ lst]]]];i++,{n,60}];Rest[lst] (* _Harvey P. Dale_, Sep 03 2011 *)

%o (PARI) digitsum(n) = local(s, d); s=0; while(n>0,d=divrem(n,10); n=d[1]; s=s+d[2]); s {sdnp(m)=local(a=1,ct=0,lp=0,ls=0,sqc=0,sr=0,t=1); for(n=1,m, if(n%2==0,b=nextprime(a+1); t+=digitsum(b); a=b; ct++; print1(b," "); if(issquare(b),sqc++; ls=b; ); sr+=(1.0/b), b=t; t+=digitsum(b); a=b; print1(b," "); if(isprime(b),ct++; lp=b; ); if(issquare(b),sqc++; ls=b; ); sr+=(1.0/b); )); print(); print(Results); print("Found "ct" primes <= "m); print("Found "sqc" squares <= "m); print("Last prime found in odd part: "lp); print("Last square found: "ls); print("Ratio of primes to "m" is "ct/m+0.0); print("Sum of reciprocals = "sr); }

%K base,easy,nonn

%O 1,2

%A _Jason Earls_, Dec 14 2002

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 April 19 09:23 EDT 2024. Contains 371782 sequences. (Running on oeis4.)