login
A078652
a(1)=1, a(2n)=nextprime(a(n-1)), a(2n+1)= sum of digits of all previous terms + 1.
0
1, 2, 4, 5, 13, 17, 25, 29, 43, 47, 61, 67, 81, 83, 101, 103, 107, 109, 125, 127, 143, 149, 165, 167, 191, 193, 215, 223, 230, 233, 243, 251, 260, 263, 279, 281, 308, 311, 324, 331, 340, 347, 361, 367, 387, 389, 425, 431, 444, 449, 473, 479, 507, 509, 533, 541
OFFSET
1,2
MATHEMATICA
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 *)
PROG
(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); }
CROSSREFS
Sequence in context: A128457 A139485 A079407 * A289491 A102992 A273097
KEYWORD
base,easy,nonn
AUTHOR
Jason Earls, Dec 14 2002
STATUS
approved