login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A073901 Number of primes with nonzero digits and digit sum n. 3
0, 2, 1, 3, 7, 0, 29, 27, 0, 90, 234, 0, 753, 1025, 0, 3876, 9242, 0, 32549, 50112, 0, 180092, 420318, 0, 1525141, 2467286, 0, 9248093, 20668960, 0, 76318859 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

a(3k) = 0 for all k>1.

The number of candidates to consider for a(n) (i.e. the number of integers with nonzero digits and digit sum n) is A104144(n+8). - Robert Israel, Jun 05 2015

LINKS

Table of n, a(n) for n=1..31.

Manfred Scheucher, Sage Script

EXAMPLE

a(2) = 2: the two primes are 2 and 11. a(5) = 7: the primes are 5, 41, 23, 113, 131, 311 and 2111.

MAPLE

S[1, 1]:= [1]:

for x from 2 to 9 do S[1, x]:= [] od:

a[1]:= 0: a[2]:= 2:

for n from 2 to 22 do

  for x from 2 to 9 do S[n, x]:= map(`+`, S[n-1, x-1], 1) od:

  S[n, 1]:= [seq(op(map(t -> 10*t+1, S[n-1, x])), x=1..9)];

  if n > 3 and n mod 3 = 0 then a[n]:= 0

  else

    if n > 5 then X:= [1, 3, 7, 9] else X:= [$1..9] fi;

    a[n]:= add(numboccur(map(isprime, S[n, x]), true), x=X);

  fi

od:

seq(a[n], n=1..22); # Robert Israel, Jun 05 2015

MATHEMATICA

f[n_] := If[ Mod[n, 3] == 0 && n > 3, 0, Block[{ip = IntegerPartitions@ n, lng = 1 + PartitionsP@ n, cnt = 0, k = 1}, While[k < lng, If[ Max@ ip[[k]] < 10, cnt += Length@ Select[ FromDigits@# & /@ Permutations@ ip[[k]], PrimeQ]]; k++]; cnt]]; Array[f, 30] (* Robert G. Wilson v, Jun 05 2015 *)

DigitSum[n_, b_:10] := Total[IntegerDigits[n, b]]; nextodd[c_] := If[ Length[c]==2, Join[ Table[1, {c[[1]]-2}], {c[[2]]+2}], Join[ Table[1, {c[[1]]-1}], {c[[2]]+1}, Drop[c, 2]]]; a[2]=2; a[n_] := If[Mod[n, 3]==0 && n>3, 0, Module[{c, ct}, For[ c = Table[1, {n}]; ct = 0, True, c = nextodd[c], If[ PrimeQ[ FromDigits[c]] && DigitSum[FromDigits[c]]==n, ct++ ]; If[ c[[ -1]] >= n-1, Return[ct]] ] ]]; Table[ a[n], {n, 20}]

CROSSREFS

Not the same as A116381.

Cf. A104144.

Sequence in context: A140644 A321651 A326308 * A116381 A176120 A220621

Adjacent sequences:  A073898 A073899 A073900 * A073902 A073903 A073904

KEYWORD

base,more,nonn

AUTHOR

Amarnath Murthy, Aug 18 2002

EXTENSIONS

Edited and extended by Robert G. Wilson v, Sep 19 2002

a(20) to a(24) and alternate Mathematica coding from Dean Hickerson, Sep 21 2002

a(25) from Robert G. Wilson v, Sep 26 2002

a(26)-a(31) from Robert G. Wilson v, Nov 14 2005

Corrected and edited by Manfred Scheucher, Jun 01 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 27 16:20 EST 2021. Contains 349394 sequences. (Running on oeis4.)