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-4 of 4 results.

A007605 Sum of digits of n-th prime.

Original entry on oeis.org

2, 3, 5, 7, 2, 4, 8, 10, 5, 11, 4, 10, 5, 7, 11, 8, 14, 7, 13, 8, 10, 16, 11, 17, 16, 2, 4, 8, 10, 5, 10, 5, 11, 13, 14, 7, 13, 10, 14, 11, 17, 10, 11, 13, 17, 19, 4, 7, 11, 13, 8, 14, 7, 8, 14, 11, 17, 10, 16, 11, 13, 14, 10, 5, 7, 11, 7, 13, 14, 16, 11, 17, 16, 13, 19, 14, 20, 19, 5
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007605_list = map a007953 a000040_list -- Reinhard Zumkeller, Aug 04 2011
    
  • Magma
    [ &+Intseq(NthPrime(n), 10): n in [1..80] ]; // Klaus Brockhaus, Jun 13 2009
    
  • Maple
    map(t -> convert(convert(t,base,10),`+`), select(isprime, [2,(2*i+1 $ i=1..1000)])); # Robert Israel, Aug 16 2015
  • Mathematica
    Table[Apply[Plus, RealDigits[Prime[n]][[1]]], {n, 1, 100}]
    Plus@@ IntegerDigits[Prime[Range[100]]] (* Zak Seidov *)
  • PARI
    dsum(n)=my(s);while(n,s+=n%10;n\=10);s
    forprime(p=2,1e3,print1(dsum(p)", ")) \\ Charles R Greathouse IV, Jul 15 2011
    
  • PARI
    a(n) = sumdigits(prime(n)); \\ Michel Marcus, Dec 20 2017
    
  • Python
    from sympy import prime
    def a(n): return sum(map(int, str(prime(n))))
    print([a(n) for n in range(1, 80)]) # Michael S. Branicky, Feb 03 2021

Formula

a(n) = A007953(A000040(n)) = A007953(prime(n)).

A067523 The smallest prime with a possible given digit sum.

Original entry on oeis.org

2, 3, 13, 5, 7, 17, 19, 29, 67, 59, 79, 89, 199, 389, 499, 599, 997, 1889, 1999, 2999, 4999, 6899, 17989, 8999, 29989, 39989, 49999, 59999, 79999, 98999, 199999, 389999, 598999, 599999, 799999, 989999, 2998999, 2999999, 4999999, 6999899, 8989999
Offset: 1

Views

Author

Amarnath Murthy, Feb 14 2002

Keywords

Comments

Except for 3 no other prime has a digit sum which is a multiple of 3. Hence the possible digit sums are 2,3,4,5,7,8,10,11,13,14,16,..., etc. Conjecture: For every possible digit sum there exists a prime.
For n > 2, this is (conjecturally) the smallest prime with digit sum A001651(n). - Lekraj Beedassy, Mar 04 2009

Crossrefs

Cf. A001651. Equals A067180 with the 0 terms removed.

Programs

  • Maple
    g:= proc(s, d) # integers of <=d digits with sum s
      local j;
      if s > 9*d then return [] fi;
      if d = 1 then return [s] fi;
      [seq(op(map(t -> j*10^(d-1)+ t, procname(s-j, d-1))), j=0..9)];
    end proc:
    f:= proc(n) local d, j, x, y;
      if n mod 3 = 0 then return 0 fi;
      for d from ceil(n/9) do
        if d = 1 then
          if isprime(n) and n < 10 then return n
          else next
        fi fi;
        for j from 1 to 9 do
           for y in g(n-j, d-1) do
             x:= 10^(d-1)*j + y;
             if isprime(x) then return x fi;
      od od od;
    end proc:
    f(3):= 3:
    map(f, [2,3,seq(seq(3*i+j,j=1..2),i=1..30)]); # Robert Israel, Jan 18 2024
  • PARI
    A067523(n)=if(n<3,n+1,A067180(n*3\/2-1)) \\ M. F. Hasler, Nov 04 2018

Formula

a(n) = min(prime(i): A007605(i) = A133223(i)). - R. J. Mathar, Nov 06 2018

Extensions

More terms from Vladeta Jovovic, Feb 18 2002
Edited by Ray Chandler, Apr 24 2007

A137269 Number of primes with maximal digit product for a digit sum of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 0, 2, 1, 0, 1, 2, 0, 5, 1, 0, 4, 3, 0, 8, 2, 0, 2, 2, 0, 10, 1, 0, 5, 4, 0, 8, 1, 0, 4, 2, 0, 17, 151, 0, 7, 4, 0, 13, 3, 0, 812, 3, 0, 17, 4, 0, 12, 1, 0, 13, 1, 0, 6, 2, 0, 18, 1, 0, 11, 1000, 0, 24, 2, 0, 5, 1, 0, 25, 1, 0, 10, 2, 0, 23, 2, 0, 9, 1
Offset: 1

Views

Author

Lekraj Beedassy, Apr 05 2008

Keywords

Comments

From Chai Wah Wu, Dec 04 2015, Nov 03 2018: (Start)
If n > 3 and n == 0 (mod 3) then a(n) = 0 since the digit sum is a multiple of 3.
Primes with digit product maximal among all numbers with the same digit sum (not just maximal among primes) only contain the digits 2, 3 or 4. A digit 0 leads to a digit product 0 which is not maximal. A digit 1 with another digit d (since 1 is not prime, there must be another digit d) can be replaced with the digit d+1 (if d < 9) which preserves the digit sum, but strictly increases the digit product (if d = 9, 1 and 9 can be replaced with 3, 3 and 4 which again increases the digit product). For a digit d > 4, there is a series of digits from the set {2,3,4} whose sum is d and whose product is strictly larger than d. For instance, 5 -> {2,3} whose product is 6. 6 -> {3,3}, 7 -> {3,4}, 8 -> {2,3,3}, 9 -> {3,3,3}. Thus the digit d in a number can be replaced with digits 2, 3, 4 to obtain a number with the same digit sum and a larger digit product. Furthermore, the digits 2 and 4 cannot both appear, the digit 2 cannot appear more than twice and the digit 4 cannot appear more than once since {3,3} also sums to 6 and has product 9 > 8.
This analysis implies the following for n > 3. If n == 1 (mod 3), then primes with maximal digit product among all numbers with the same digit sum (if they exist) have digits 3 and either two digits 2 or a single digit 4. If n == 2 (mod 3), then primes with maximal digit product among all numbers with the same digit sum (if they exist) have digits 3 and a single digit 2. Values for n for which such primes do not exist are 4, 38, 46, 65, 94, ... In these cases a(n) can still be > 0, but the digit product of these primes is not maximal among all numbers with digit sum n. So far, it seems that in these cases (except for n = 4) these primes also only contain the digits 2, 3, or 4.
(End)

Examples

			a(19)=8 and a(20)=2 because we respectively have the 8 primes 333433, 334333, 343333, 2332333, 2333323, 3223333, 3233323, 3332233 all with a maximal digit product of 3^5*2^2 = 972 for a digit sum of 19 and the 2 primes 3233333, 3333233 with maximal digit product 3^6*2 = 1458 for digit sum 20.
		

Crossrefs

Programs

  • Mathematica
    Needs["Combinatorica`"]; Table[If[And[n > 3, Divisible[n, 3]], 0, Length@ MaximalBy[Select[FromDigits /@ Flatten[Map[Permutations, Combinatorica`Partitions@ n], 1] /. x_ /; EvenQ@ x -> Nothing, PrimeQ], Times @@ IntegerDigits@ # &]], {n, 24}] (* Michael De Vlieger, Dec 11 2015, Version 10 *)

Extensions

a(25) and a(28) corrected and a(29)-a(83) added by Chai Wah Wu, Nov 30 2015

A303273 Array T(n,k) = binomial(n, 2) + k*n + 1 read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 3, 4, 4, 1, 4, 6, 7, 7, 1, 5, 8, 10, 11, 11, 1, 6, 10, 13, 15, 16, 16, 1, 7, 12, 16, 19, 21, 22, 22, 1, 8, 14, 19, 23, 26, 28, 29, 29, 1, 9, 16, 22, 27, 31, 34, 36, 37, 37, 1, 10, 18, 25, 31, 36, 40, 43, 45, 46, 46, 1, 11, 20, 28, 35, 41
Offset: 0

Views

Author

Keywords

Comments

Columns are linear recurrence sequences with signature (3,-3,1).
8*T(n,k) + A166147(k-1) are squares.
Columns k are binomial transforms of [1, k, 1, 0, 0, 0, ...].
Antidiagonals sums yield A116731.

Examples

			The array T(n,k) begins
1    1    1    1    1    1    1    1    1    1    1    1    1  ...  A000012
1    2    3    4    5    6    7    8    9   10   11   12   13  ...  A000027
2    4    6    8   10   12   14   16   18   20   22   24   26  ...  A005843
4    7   10   13   16   19   22   25   28   31   34   37   40  ...  A016777
7   11   15   19   23   27   31   35   39   43   47   51   55  ...  A004767
11  16   21   26   31   36   41   46   51   56   61   66   71  ...  A016861
16  22   28   34   40   46   52   58   64   70   76   82   88  ...  A016957
22  29   36   43   50   57   64   71   78   85   92   99  106  ...  A016993
29  37   45   53   61   69   77   85   93  101  109  117  125  ...  A004770
37  46   55   64   73   82   91  100  109  118  127  136  145  ...  A017173
46  56   66   76   86   96  106  116  126  136  146  156  166  ...  A017341
56  67   78   89  100  111  122  133  144  155  166  177  188  ...  A017401
67  79   91  103  115  127  139  151  163  175  187  199  211  ...  A017605
79  92  105  118  131  144  157  170  183  196  209  222  235  ...  A190991
...
The inverse binomial transforms of the columns are
1    1    1    1    1    1    1    1    1    1    1    1    1  ...
0    1    2    3    4    5    6    7    8    9   10   11   12  ...
1    1    1    1    1    1    1    1    1    1    1    1    1  ...
0    0    0    0    0    0    0    0    0    0    0    0    0  ...
0    0    0    0    0    0    0    0    0    0    0    0    0  ...
0    0    0    0    0    0    0    0    0    0    0    0    0  ...
...
T(k,n-k) = A087401(n,k) + 1 as triangle
1
1   1
1   2   2
1   3   4   4
1   4   6   7   7
1   5   8  10  11  11
1   6  10  13  15  16  16
1   7  12  16  19  21  22  22
1   8  14  19  23  26  28  29  29
1   9  16  22  27  31  34  36  37  37
1  10  18  25  31  36  40  43  45  46  46
...
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics: A Foundation for Computer Science, Addison-Wesley, 1994.

Crossrefs

Programs

  • Maple
    T := (n, k) -> binomial(n, 2) + k*n + 1;
    for n from 0 to 20 do seq(T(n, k), k = 0 .. 20) od;
  • Mathematica
    Table[With[{n = m - k}, Binomial[n, 2] + k n + 1], {m, 0, 11}, {k, m, 0, -1}] // Flatten (* Michael De Vlieger, Apr 21 2018 *)
  • Maxima
    T(n, k) := binomial(n, 2)+ k*n + 1$
    for n:0 thru 20 do
        print(makelist(T(n, k), k, 0, 20));
    
  • PARI
    T(n,k) = binomial(n, 2) + k*n + 1;
    tabl(nn) = for (n=0, nn, for (k=0, nn, print1(T(n, k), ", ")); print); \\ Michel Marcus, May 17 2018

Formula

G.f.: (3*x^2*y - 3*x*y + y - 2*x^2 + 2*x - 1)/((x - 1)^3*(y - 1)^2).
E.g.f.: (1/2)*(2*x*y + x^2 + 2)*exp(y + x).
T(n,k) = 3*T(n-1,k) - 3*T(n-2,k) + T(n-3,k), with T(0,k) = 1, T(1,k) = k + 1 and T(2,k) = 2*k + 2.
T(n,k) = T(n-1,k) + n + k - 1.
T(n,k) = T(n,k-1) + n, with T(n,0) = 1.
T(n,0) = A152947(n+1).
T(n,1) = A000124(n).
T(n,2) = A000217(n).
T(n,3) = A034856(n+1).
T(n,4) = A052905(n).
T(n,5) = A051936(n+4).
T(n,6) = A246172(n+1).
T(n,7) = A302537(n).
T(n,8) = A056121(n+1) + 1.
T(n,9) = A056126(n+1) + 1.
T(n,10) = A051942(n+10) + 1, n > 0.
T(n,11) = A101859(n) + 1.
T(n,12) = A132754(n+1) + 1.
T(n,13) = A132755(n+1) + 1.
T(n,14) = A132756(n+1) + 1.
T(n,15) = A132757(n+1) + 1.
T(n,16) = A132758(n+1) + 1.
T(n,17) = A212427(n+1) + 1.
T(n,18) = A212428(n+1) + 1.
T(n,n) = A143689(n) = A300192(n,2).
T(n,n+1) = A104249(n).
T(n,n+2) = T(n+1,n) = A005448(n+1).
T(n,n+3) = A000326(n+1).
T(n,n+4) = A095794(n+1).
T(n,n+5) = A133694(n+1).
T(n+2,n) = A005449(n+1).
T(n+3,n) = A115067(n+2).
T(n+4,n) = A133694(n+2).
T(2*n,n) = A054556(n+1).
T(2*n,n+1) = A054567(n+1).
T(2*n,n+2) = A033951(n).
T(2*n,n+3) = A001107(n+1).
T(2*n,n+4) = A186353(4*n+1) (conjectured).
T(2*n,n+5) = A184103(8*n+1) (conjectured).
T(2*n,n+6) = A250657(n-1) = A250656(3,n-1), n > 1.
T(n,2*n) = A140066(n+1).
T(n+1,2*n) = A005891(n).
T(n+2,2*n) = A249013(5*n+4) (conjectured).
T(n+3,2*n) = A186384(5*n+3) = A186386(5*n+3) (conjectured).
T(2*n,2*n) = A143689(2*n).
T(2*n+1,2*n+1) = A143689(2*n+1) (= A030503(3*n+3) (conjectured)).
T(2*n,2*n+1) = A104249(2*n) = A093918(2*n+2) = A131355(4*n+1) (= A030503(3*n+5) (conjectured)).
T(2*n+1,2*n) = A085473(n).
a(n+1,5*n+1)=A051865(n+1) + 1.
a(n,2*n+1) = A116668(n).
a(2*n+1,n) = A054569(n+1).
T(3*n,n) = A025742(3*n-1), n > 1 (conjectured).
T(n,3*n) = A140063(n+1).
T(n+1,3*n) = A069099(n+1).
T(n,4*n) = A276819(n).
T(4*n,n) = A154106(n-1), n > 0.
T(2^n,2) = A028401(n+2).
T(1,n)*T(n,1) = A006000(n).
T(n*(n+1),n) = A211905(n+1), n > 0 (conjectured).
T(n*(n+1)+1,n) = A294259(n+1).
T(n,n^2+1) = A081423(n).
T(n,A000217(n)) = A158842(n), n > 0.
T(n,A152947(n+1)) = A060354(n+1).
floor(T(n,n/2)) = A267682(n) (conjectured).
floor(T(n,n/3)) = A025742(n-1), n > 0 (conjectured).
floor(T(n,n/4)) = A263807(n-1), n > 0 (conjectured).
ceiling(T(n,2^n)/n) = A134522(n), n > 0 (conjectured).
ceiling(T(n,n/2+n)/n) = A051755(n+1) (conjectured).
floor(T(n,n)/n) = A133223(n), n > 0 (conjectured).
ceiling(T(n,n)/n) = A007494(n), n > 0.
ceiling(T(n,n^2)/n) = A171769(n), n > 0.
ceiling(T(2*n,n^2)/n) = A046092(n), n > 0.
ceiling(T(2*n,2^n)/n) = A131520(n+2), n > 0.
Showing 1-4 of 4 results.