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

A279437 Number of ways to place 3 points on an n X n square grid so that no more than 2 points are on a vertical or horizontal straight line.

Original entry on oeis.org

0, 4, 78, 528, 2200, 6900, 17934, 40768, 83808, 159300, 284350, 482064, 782808, 1225588, 1859550, 2745600, 3958144, 5586948, 7739118, 10541200, 14141400, 18711924, 24451438, 31587648, 40380000, 51122500, 64146654, 79824528, 98571928, 120851700, 147177150, 178115584
Offset: 1

Views

Author

Heinrich Ludwig, Dec 12 2016

Keywords

Comments

Column 4 of triangle A279445.
Rotations and reflections of placements are counted. For numbers if they are to be ignored see A279447.
For condition "no more than 2 points on straight lines at any angle", see A045996.

Crossrefs

Same problem but 2, 4..9 points: A083374, A279438, A279439, A279440, A279441, A279442, A279443.

Programs

  • Mathematica
    Table[(n^6 - 5 n^4 + 6 n^3 - 2 n^2)/6, {n, 32}] (* or *)
    Rest@ CoefficientList[Series[2 x^2*(2 + 25 x + 33 x^2 + x^3 - x^4)/(1 - x)^7, {x, 0, 32}], x] (* Michael De Vlieger, Dec 12 2016 *)
  • PARI
    concat(0, Vec(2*x^2*(2 + 25*x + 33*x^2 + x^3 - x^4) / (1 - x)^7 + O(x^50))) \\ Colin Barker, Dec 12 2016

Formula

a(n) = (n^6 - 5*n^4 + 6*n^3 - 2*n^2)/6.
a(n) = 7*a(n-1) - 21*a(n-2) + 35*a(n-3) - 35*a(n-4) + 21*a(n-5) - 7*a(n-6) + a(n-7).
G.f.: 2*x^2*(2 + 25*x + 33*x^2 + x^3 - x^4) / (1 - x)^7. - Colin Barker, Dec 12 2016

A249448 Largest n-digit prime whose digit sum is also prime.

Original entry on oeis.org

7, 89, 991, 9967, 99991, 999983, 9999971, 99999989, 999999937, 9999999943, 99999999821, 999999999989, 9999999999971, 99999999999923, 999999999999883, 9999999999999851, 99999999999999997, 999999999999999967, 9999999999999999919, 99999999999999999989, 999999999999999999829
Offset: 1

Views

Author

Paolo P. Lava, Oct 29 2014

Keywords

Comments

Subsequence of A046704 (primes with digit sum being prime).
Some terms of this sequence are also in A003618, the largest n-digit primes.

Examples

			a(1) = 7 because it is the largest prime with just one digit.
a(2) = 89 because it is the largest prime with 2 digits whose sum, 8 + 9 = 17, is a prime.
Again, a(7) = 9999971 because it is the largest prime with 7 digits whose sum is a prime: 9 + 9 + 9 + 9 + 9 + 7 + 1 = 53.
		

Crossrefs

Programs

  • Maple
    P:=proc(q) local a,b,k,n; for k from 0 to q do
    for n from 10^(k+1)-1 by -1 to 10^k do if isprime(n) then a:=n; b:=0;
    while a>0 do b:=b+(a mod 10); a:=trunc(a/10); od;
    if isprime(b) then print(n); break; fi; fi;
    od; od; end: P(10^3);
  • Mathematica
    Table[Module[{p=NextPrime[10^n,-1]},While[!PrimeQ[Total[IntegerDigits[p]]],p=NextPrime[p,-1]];p],{n,25}] (* Harvey P. Dale, Jun 20 2023 *)
  • PARI
    a(n) = {p = precprime(10^n); while (!isprime(sumdigits(p)), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 29 2014
Showing 1-2 of 2 results.