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.

A028834 Numbers whose sum of digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 131, 133, 137, 139, 140, 142, 146, 148, 151, 155, 157, 160, 164, 166, 173, 175, 179, 182
Offset: 1

Views

Author

Armand Turpel (armand(AT)vo.lu, armand_t(AT)geocities.com)

Keywords

Examples

			89 included because 8+9 = 17, which is prime.
		

Crossrefs

Cf. A010051; A046704 is a subsequence.
Complement of A104211.

Programs

  • Haskell
    a028834 n = a028834_list !! (n-1)
    a028834_list = filter ((== 1) . a010051 . a007953) [1..]
    -- Reinhard Zumkeller, Nov 13 2011
    
  • Maple
    a:=proc(n) local nn: nn:=convert(n,base,10): if isprime(sum(nn[j],j=1..nops(nn)))=true then n else fi end: seq(a(n),n=1..200); # Emeric Deutsch, Mar 17 2007
  • Mathematica
    Select[Range[200],PrimeQ[Total[IntegerDigits[#]]]&]  (* Harvey P. Dale, Feb 18 2011 *)
  • PARI
    is(n)=isprime(sumdigits(n)) \\ Felix Fröhlich, Aug 16 2014
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(sum(map(int, str(n))))
    print(list(filter(ok, range(183)))) # Michael S. Branicky, Jun 18 2021
    
  • R
    require(gmp); which(sapply(1:1000, function(i) isprime(sum(floor(i/10^(0:(nchar(i)-1)))%%10)))==2) # Christian N. K. Anderson, Apr 22 2024
  • Sage
    [x for x in range(200) if (sum(Integer(x).digits(base=10))) in Primes()] # Bruno Berselli, May 05 2014
    

Extensions

More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)