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.

A225048 Numbers that cannot be expressed as n plus the sum of the squared digits of n for any integer n.

Original entry on oeis.org

1, 3, 4, 5, 7, 8, 9, 10, 14, 15, 16, 18, 19, 21, 22, 25, 27, 28, 29, 32, 33, 34, 35, 37, 38, 40, 43, 46, 47, 48, 49, 50, 52, 55, 57, 60, 61, 63, 64, 65, 70, 71, 73, 74, 78, 79, 82, 84, 85, 88, 89, 91, 92, 93, 94, 97, 99, 100, 104, 106, 109, 110, 115, 120, 122
Offset: 1

Views

Author

Keywords

Comments

A natural extension of the Self or Colombian numbers (A003052).
Up to 144, there are more numbers that cannot be expressed in this way than numbers that can. Thereafter, there are always more numbers that can.

Examples

			26 is not in the sequence, because 21+2^2+1^2=26. However, no such solution exists for 25 or 27.
		

Crossrefs

Programs

  • Mathematica
    nn=122;Complement[Range[nn],Table[n+Total[IntegerDigits[n]^2],{n,nn}]] (* Jayanta Basu, May 05 2013 *)
  • R
    digsqsum<-function(x) sum(as.numeric(unlist(strsplit(as.character(x),split="")))^2)
    which(is.na(match(1:1000,1:1000+sapply(1:1000,digsqsum)))

A225049 Numbers that can be expressed as n plus sum of squared digits(n) in more than one way.

Original entry on oeis.org

30, 41, 56, 81, 95, 96, 98, 101, 112, 114, 121, 125, 131, 142, 146, 152, 157, 168, 173, 177, 182, 186, 191, 196, 197, 199, 206, 209, 213, 215, 216, 217, 227, 230, 232, 234, 240, 243, 245, 247, 248, 257, 260, 262, 266, 272, 276, 284, 285, 287, 292, 299, 300
Offset: 1

Views

Author

Keywords

Examples

			a(13) = 131 is included because 131 = 57+5^2+7^2 = 73+7^2+3^2 = 105+1^2+5^2 = 122 + 1^2+4^2+4^2.
		

Crossrefs

Programs

  • R
    digsqsum<-function(x) sum(as.numeric(unlist(strsplit(as.character(x),split="")))^2)
    1:500+sapply(1:500,digsqsum)->y
    table(y)->ty; names(ty[ty>1])

A327893 Minesweeper sequence of positive integers arranged in a hexagonal spiral.

Original entry on oeis.org

4, -1, -1, 3, -1, 3, -1, 3, 2, 4, -1, 3, -1, 3, 2, 2, -1, 3, -1, 2, 0, 2, -1, 3, 1, 2, 2, 2, -1, 2, -1, 1, 1, 1, 2, 3, -1, 2, 0, 1, -1, 4, -1, 1, 1, 2, -1, 1, 0, 1, 2, 3, -1, 3, 1, 0, 0, 1, -1, 4, -1, 1, 0, 0, 1, 3, -1, 2, 2, 2, -1, 2, -1, 3, 1, 1, 0, 1, -1, 3
Offset: 1

Views

Author

Michael De Vlieger, Oct 09 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the center and continue along a hexagonal spiral. Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it. n is replaced by a(n). This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
The largest term in the sequence is 4 since 1 is surrounded by 3 odd numbers {3, 5, 7} and the only even prime. Additionally, the pattern of odd and even numbers appears in alternating rows oriented in a triangular symmetry such that no other number has more than four odd numbers. (This courtesy of Witold Tatkiewicz.)

Examples

			Consider a spiral grid drawn counterclockwise with the largest number k = A003219(n) = 3*n*(n+1)+1 in "shell" n, and each shell has A008458(n) elements:
          28--27--26--25
          /             \
        29  13--12--11  24
        /   /         \   \
      30  14   4---3  10  23
      /   /   /     \   \   \
    31  15   5   1---2   9  22
      \   \   \         /   /
      32  16   6---7---8  21
        \   \             /
        33  17--18--19--20  ...
          \                /
          34--35--36--37--38
1 is not prime and in the 6 adjacent cells 2 through 7 inclusive, we have 4 primes, therefore a(1) = 4.
2 is prime therefore a(2) = -1.
4 is not prime and in the 6 adjacent cells {1, 3, 12, 13, 14, 5} there are 4 primes, therefore a(4) = 4, etc.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
         2---2---2---1
        /             \
       *   *---3---*   3
      /   /         \   \
     2   3   3---*   4   *
    /   /   /     \   \   \
   *   2   *   4---*   2   2
    \   \   \         /   /
     1   3   3---*---3   .
      \   \             /
       1   *---3---*---2  ...
        \                 /
         1---2---3---*---2
		

Crossrefs

Programs

  • Mathematica
    Block[{n = 6, m, s, t, u}, m = n + 1; s = Array[3 #1 (#1 - 1) + 1 + #2 #1 + #3 & @@ {#3, #4, Which[Mod[#4, 3] == 0, Abs[#1], Mod[#4, 3] == 1, Abs[#2], True, Abs[#2] - Abs[#1]]} & @@ {#1, #2, If[UnsameQ @@ Sign[{#1, #2}], Abs[#1] + Abs[#2], Max[Abs[{#1, #2}]]], Which[And[#1 > 0, #2 <= 0], 0, And[#1 >= #2, #1 + #2 > 0], 1, And[#2 > #1, #1 >= 0], 2, And[#1 < 0, #2 >= 0], 3, And[#1 <= #2, #1 + #2 < 0], 4, And[#1 > #2, #1 + #2 <= 0], 5, True, 0]} & @@ {#2 - m - 1, m - #1 + 1} &, {#, #}] &[2 m + 1]; t = s /. k_ /; k > 3 n (n + 1) + 1 :> -k; Table[If[PrimeQ@ m, -1, Count[#, _?PrimeQ] &@ Union@ Map[t[[#1, #2]] & @@ # &, Join @@ Array[FirstPosition[t, m] + {##} - 2 & @@ {#1, #2 + Boole[#1 == #2 == 2] + Boole[#1 == 1]} &, {3, 2}]]], {m, 3 n (n - 1) + 1}]]
Showing 1-3 of 3 results.