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.

A106782 Primes with digit sum = 53.

This page as a plain text file.
%I A106782 #19 Mar 10 2022 18:33:21
%S A106782 989999,1799999,1889999,1988999,1989899,1989989,1997999,1999799,
%T A106782 1999889,1999979,2699999,2799899,2799989,2879999,2899997,2978999,
%U A106782 2979989,2988899,2989799,2989997,2998997,2999879,2999897,3698999,3789899
%N A106782 Primes with digit sum = 53.
%C A106782 There are (1, 10, 23, 43, 87, 146, 255, 408, 642) terms below (1, 2, 3, ..., 9)*10^6. Among the 960 terms below 10^7, only {8998991, 8999981, 9899891, 9988991, 9997991, 9999971} end in the digit 1, only 30 end in the digit 3, and 268 end with a digit 7. - _M. F. Hasler_, Mar 09 2022
%H A106782 Michael S. Branicky, <a href="/A106782/b106782.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Vincenzo Librandi)
%t A106782 Select[Prime[Range[270000]],Total[IntegerDigits[#]]==53&]  (* _Harvey P. Dale_, Apr 17 2011 *)
%o A106782 (Magma) [p: p in PrimesUpTo(3800000) | &+Intseq(p) eq 53]; // _Vincenzo Librandi_, Jul 09 2014
%o A106782 (PARI) select( {is_A106782(p)=sumdigits(p)==53&&isprime(p)}, primes([9e5,4e6]\1)) \\ _M. F. Hasler_, Mar 09 2022
%o A106782 (Python)
%o A106782 from itertools import count, islice
%o A106782 from sympy import isprime
%o A106782 from sympy.utilities.iterables import multiset_permutations
%o A106782 def agen(b=10, sod=53): # generator for any base, sum-of-digits
%o A106782     if 0 <= sod < b:
%o A106782         yield sod
%o A106782     nzdigs = [i for i in range(1, b) if i <= sod]
%o A106782     nzmultiset = []
%o A106782     for d in range(1, b):
%o A106782         nzmultiset += [d]*(sod//d)
%o A106782     for d in count(2):
%o A106782         fullmultiset = [0]*(d-1-(sod-1)//(b-1)) + nzmultiset
%o A106782         for firstdig in nzdigs:
%o A106782             target_sum, restmultiset = sod - int(firstdig), fullmultiset[:]
%o A106782             restmultiset.remove(firstdig)
%o A106782             for p in multiset_permutations(restmultiset, d-1):
%o A106782                 if sum(p) == target_sum:
%o A106782                     t = int("".join(map(str, [firstdig]+p)), b)
%o A106782                     if isprime(t):
%o A106782                         yield t
%o A106782                     if p[0] == target_sum:
%o A106782                         break
%o A106782 print(list(islice(agen(), 25))) # _Michael S. Branicky_, Mar 10 2022
%Y A106782 Cf. similar sequences listed in A244918.
%K A106782 nonn,base
%O A106782 1,1
%A A106782 _Zak Seidov_, May 16 2005