cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A141642 Composite numbers whose sum of digits is a prime.

Original entry on oeis.org

12, 14, 16, 20, 21, 25, 30, 32, 34, 38, 49, 50, 52, 56, 58, 65, 70, 74, 76, 85, 92, 94, 98, 102, 104, 106, 110, 111, 115, 119, 120, 122, 124, 128, 133, 140, 142, 146, 148, 155, 160, 164, 166, 175, 182, 184, 188, 200, 201, 203, 205, 209, 210, 212, 214, 218, 221, 230, 232, 236
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Sep 03 2008

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[300],CompositeQ[#]&&PrimeQ[Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Feb 19 2018 *)
  • Python
    from sympy import isprime
    def ok(n): return isprime(sum(map(int, str(n)))) and not isprime(n)
    print([k for k in range(237) if ok(k)]) # Michael S. Branicky, Dec 14 2021

Extensions

More terms from N. J. A. Sloane, Sep 03 2008

A228020 Composite numbers whose initial, all intermediate and final iterated digit sums are composite numbers.

Original entry on oeis.org

4, 6, 8, 9, 15, 18, 22, 24, 26, 27, 33, 35, 36, 40, 42, 44, 45, 51, 54, 60, 62, 63, 69, 72, 78, 80, 81, 87, 90, 96, 99, 105, 108, 112, 114, 116, 117, 121, 123, 125, 126, 130, 132, 134, 135, 141, 143, 144, 150, 152, 153, 159, 161, 162, 168, 170, 171, 177, 180, 186, 189, 195, 198, 202, 204, 206
Offset: 1

Views

Author

Derek Orr, Aug 02 2013

Keywords

Comments

a(n) is congruent to 0, 4, 6 or 8 mod 9. - Robert Israel, Aug 12 2014

Examples

			78 is a term because 78, 7+8 = 15, and 1+5 = 6 are composite.
		

Crossrefs

A subset of A228019 and A104211.

Programs

  • Maple
    filter:= proc(n) local x;
    x:= n;
    do
       if isprime(x) then return false fi;
       if x < 10 then return (x > 1) fi;
       x:= convert(convert(x,base,10),`+`);
    od:
    end proc;
    select(filter,[$4..1000]); # Robert Israel, Aug 12 2014
  • Mathematica
    okQ[n_] := n > 1 && !PrimeQ[n] && (n < 10 || okQ@ Total@ IntegerDigits@ n); Select[Range@168, okQ] (* Giovanni Resta, Aug 05 2013 *)
    cnQ[n_]:=AllTrue[NestWhileList[Total[IntegerDigits[#]]&,n,#>9&], CompositeQ]; Select[Range[210],cnQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Mar 25 2016 *)
  • PARI
    forcomposite(n=1,500,s=sumdigits(n);while(s>9&&!isprime(s)&&s!=1,s=sumdigits(s));if(!isprime(s)&&s!=1,print1(n,", "))) \\ Derek Orr, Aug 12 2014

A329522 Composite numbers whose sum of digits is not composite.

Original entry on oeis.org

10, 12, 14, 16, 20, 21, 25, 30, 32, 34, 38, 49, 50, 52, 56, 58, 65, 70, 74, 76, 85, 92, 94, 98, 100, 102, 104, 106, 110, 111, 115, 119, 120, 122, 124, 128, 133, 140, 142, 146, 148, 155, 160, 164, 166, 175, 182, 184, 188, 200, 201, 203, 205, 209, 210, 212, 214, 218, 221, 230
Offset: 1

Views

Author

Ali Adams, Nov 15 2019

Keywords

Crossrefs

Programs

  • Magma
    [k:k in [2..230]| not IsPrime(k) and (IsPrime(&+Intseq(k)) or &+Intseq(k) eq 1) ]; // Marius A. Burtea, Feb 05 2020
  • Mathematica
    Select[Rest@ Complement[#, Prime@ Range@ PrimePi@ Max@ #] &@ Range@ 230, ! CompositeQ@ Total@ IntegerDigits@ # &] (* Michael De Vlieger, Nov 15 2019 *)
    Select[Range[250],CompositeQ[#]&&!CompositeQ[Total[IntegerDigits[#]]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 19 2021 *)
  • PARI
    lista(nn) = forcomposite(c=1, nn, my(s=sumdigits(c)); if ((s==1) || isprime(s), print1(c, ", "))); \\ Michel Marcus, Nov 15 2019
    
Showing 1-3 of 3 results.