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
KEYWORD
base,easy,nonn
AUTHOR
Jason Earls, Dec 14 2002
STATUS
approved