Showing posts with label OEIS. Show all posts
Showing posts with label OEIS. Show all posts

Sunday, October 25, 2026

City-Building Sequence: The 400000th sequence in the On-Line Encyclopedia of Integer Sequences

 


The community supporting the On-Line Encyclopedia of Integer Sequences (OEIS) recently had nominations to determine which sequence should be given the designation A400000. The winning sequence is shown by the illustration above and is called the City-Building Sequence. The city-building sequence is the integer sequence obtained by placing buildings at consecutive integer positions along a straight street, choosing each height to be the smallest nonnegative integer equal to the number of earlier rooftops visible from its top. A rooftop is visible when every intervening rooftop lies on or below the line segment joining it to the new rooftop. In particular, collinear rooftops count separately. It could also be called a rooftop visibility sequence. The first building has height 0, and the first terms are 0, 1, 1, 2, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 10, ... (OEIS A400000).

There were many sequences nominated to have the honor of being A400000 and the many of these were awarded designations near A400000: https://oeis.org/wiki/A400K_Winners.

Thursday, May 28, 2026

OEIS - Contributions

 https://www.insightest.app/apps/math/oeis/jim.html

When I create a sequence for the On-Line Encyclopedia of Integer Sequences (OEIS), I typically post it in this blog. A colleague of mine, Vincenzo Manto, created the above webpage with all my contributions.

Wednesday, May 20, 2026

Contribution to the OEIS - A395743

 A395743

Sum of the cumulative number of previous occurrences of the digits of n in the sequence 1..n excluding the current occurrence of each digit.
0
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 5, 6, 7, 8, 9, 10, 11, 12, 3, 15, 9, 8, 9, 10, 11, 12, 13, 14, 5, 17, 18, 13, 11, 12, 13, 14, 15, 16, 7, 19, 20, 21, 17, 14, 15, 16, 17, 18, 9, 21, 22, 23, 24, 21, 17, 18, 19, 20, 11, 23, 24, 25, 26, 27, 25, 20, 21, 22, 13
OFFSET
1,11
COMMENTS
This sequence is the exclusive counterpart to A343644. While A343644 counts the occurrences of digits in the range [1,n], a(n) counts only the occurrences strictly preceding each digit of n. Formally a(n) = A343644(n) - A055642(n). Thus, this sequence represents the exclusive scan of digit occurrences, whereas A343644 is the inclusive scan. a(n) = 0 for all single-digit n as it measures the cumulative repetition of digits at the exact moment n is formed.
FORMULA
a(n) = Sum_{i=1..k} C(d_i), where d_1, d_2, ..., d_k are the digits of n, and C(d_i) is the number of times digit d_i has appeared in the concatenation of all integers from 1 to n-1 plus the digits of n to the left of d_i.
a(n) = A343644(n) - A055642(n).
EXAMPLE
For n = 11:
The digits are '1' and '1'.
- First '1': Appeared previously in {1, 10} -> count = 2.
- Second '1': Appeared previously in {1, 10} AND as the first digit of 11 -> count = 3.
a(11) = 2 + 3 = 5.
For n = 12:
The digits are '1' and '2'.
- Digit '1': Appeared in {1, 10, 11 (twice)} -> count = 4.
- Digit '2': Appeared in {2} -> count = 1.
a(12) = 4 + 1 = 5.
MATHEMATICA
a[n_]:=Module[{sm=0, id=IntegerDigits[n], d=IntegerDigits/@Range[n-1]//Flatten}, Do[sm=sm+Count[Join[d, Take[id, i-1]], id[[i]]], {i, IntegerLength[n]}]; sm]; Array[a, 70]
PROG
(Python)
def generate_sequence(limit):
seq = []
counts = [0] * 10
for n in range(1, limit + 1):
v = 0
s = str(n)
for char in s:
d = ord(char) - 48
v += counts[d]
counts[d] += 1
seq.append(v)
return seq
print(generate_sequence(70))
CROSSREFS
KEYWORD
nonn,base,easy,new
AUTHOR
STATUS
approved

Sunday, March 29, 2026

A392975 - A contribution to the On-Line Encyclopedia of Integer Sequences (OEIS)

 

(Image: Michael De Vlieger)

I recently proposed a new sequence for the On-Line Encyclopedia of Integer Sequences (OEIS). 

A Sisyphus sequence: a(0) = 0, a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest unused positive integer having the same greatest prime factor as the sum of the previous terms.

Sisyphus is a figure in Greek mythology, known as the cunning King of Corinth who was punished by Zeus to eternally roll a massive boulder up a hill in Tartarus, only for it to roll back down each time. Numerical sequences are sometimes called Sisyphus sequences when their terms climb and climb, but then drop repeatedly. 

The image above shows this process for this sequence for the first 10^6 terms. Below is a graph for how the sequence begins (first 300 terms):

One interesting feature of the sequence is the low points all appear to be prime. They begin:  7, 13, 17, 19, 23, 29, 59, 107, 137, 173, 257, 293, 467, 503...
This trend continues for at least the first 200,000 terms of the sequence.

Another feature of the sequence is that beginning with the third term, the common greatest prime factor repeats in runs of 3 or more. These factors begin:  3, 3, 3, 7, 7, 7, 7, 13, 13, 13, 13... and this trend continues for at least the first 200,000 terms of the sequence.



(Image: Sisyphus (1548–49) by Titian, Prado Museum, Madrid, Spain)

Update 4/3/2026: the sequence was published A392975 - OEIS .

Update 4/14/2026: a companion sequence, A396326, was published: Low points in A392975 (having the property of being all prime numbers).

Tuesday, October 14, 2025

A389240 - A contribution to the On-Line Encyclopedia of Integer Sequences (OEIS)

This new sequence was just published today. I was happy to collaborate with my friend and fellow Illinois Tech alumnus and swimmer, Michael De Vlieger.

A389240

Start the sequence S with S(1) = n and extend S with S(m+1) = S(m)/2 when S(m) is even, otherwise with S(m) + the smallest odd number not yet added. a(n) is the number of steps to reach 1, or -1 if 1 is never reached.
0
0, 1, 3, 2, 8, 4, 4, 3, 6, 9, 9, 5, 33, 5, 5, 4, 9, 7, 7, 10, -1, 10, 10, 6, 7, 34, 34, 6, 13, 6, 6, 5, 34, 10, 10, 8, 9, 8, 8, 11, 10, -1, -1, 11, 11, 11, 11, 7, -1, 8, 8, 35, 34, 35, 35, 7, 8, 14, 14, 7, 96, 7, 7, 6, 14, 35, 35, 11, -1, 11, 11, 9, 35, 10, 10
OFFSET
1,3
COMMENTS
For n = 1, S begins 1, 2, 1, 4, 2. The subsequent terms are A066070.
FORMULA
a(2^k) = k.
a(2^k-1) = k+1 for k > 1.
a(2^k-2) = k+1 for k > 2.
For odd m and a(m) = h, a(2^k*m) = h+k.
EXAMPLE
For n = 5, S begins 5, 6, 3, 6, 3, 8, 4, 2, 1, thus 8 steps to reach 1, so a(5) = 8.
For n = 21, S begins 21, 22, 11, 14, 7, 12, 6, 3, 10, 5, 14, 7, 18, 9. Starting with the 7th step, 3, alternating terms of S are the odd numbers 3, 5, 7, 9..., so the sequence never reaches 1; a(21) = -1.
MATHEMATICA
Table[m = -1;
If[#[[-1]] == 1, -1 + Length[#], -1] &@
If[n < 5,
NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n, # > 1 &],
NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n,
And[#4 > 1, Nand[#1 == #3 - 2, #2 == #4 - 4]] &, 4]], {n, 75}]
CROSSREFS
KEYWORD
sign,new
AUTHOR
STATUS
approved

Friday, September 19, 2025

A Rock of Sisyphus Reached One

 

An interesting variation of the Sisyphus Sequence, A350877,  is starting the sequence with 1008973 instead of 1. With most first terms, the sequence eventually reaches 1; however, in the case of 1008973, it didn't appear that 1 would be reached. Then, after 3584971546 terms, 1 is reached. 

This is documented in the Online Encyclopedia of Integer Sequences (OEIS) with sequence https://oeis.org/A388141.

The number of steps required to reach 1 when starting the Sisyphus Sequence with integer n, is A388038.

Other posts:



Tuesday, September 16, 2025

A388038: Contribution to the OEIS (a(n) is the number of steps to reach 1 when the Sisyphus sequence (A350877) begins with n, or -1 if 1 is never reached.)

 A388038

a(n) is the number of steps to reach 1 when the Sisyphus sequence (A350877) begins with n, or -1 if 1 is never reached.
0
0, 1, 5, 2, 979, 6, 8, 3, 13, 980, 6, 7, 209, 9, 980, 4, 8, 14, 9, 981, 10, 7, 14, 8, 980, 210, 7, 10, 20, 981, 210, 5, 14, 9, 981, 15, 13, 10, 9, 982, 210, 11, 10, 8, 806, 15, 11, 9, 9, 981, 15, 211, 980, 8, 981, 11, 11, 21, 8, 982, 16, 211, 21, 6, 981, 15, 211
OFFSET
1,3
COMMENTS
Rules of the Sisyphus sequence (A350877): if the last term, s(m), is even, s(m+1) = s(m)/2; otherwise, s(m+1) = s(m) + the smallest prime not yet added.
Beginning the Sisyphus sequence with the seed 1008973 runs more than 2^30 terms without reaching 1 (A388141). Michael S. Branicky found that A388141(3584971546) = 1. - Michael De Vlieger, Sep 14 2025
LINKS
Michael De Vlieger, The Sisyphus Sequence, 2022.
EXAMPLE
For n = 1, a(n) = 0, no steps are required to reach 1.
For n = 3, a(n) = 5.
Step 1: 3 is odd, the next term is 3 + 2 (first prime) = 5.
Step 2: 5 is odd, the next term is 5 + 3 (next prime) = 8.
Step 3: 8 is even, the next term is 8/2 = 4.
Step 4: 4 is even, the next term is 4/2 = 2.
Step 5: 2 is even, the next term is 2/2 = 1.
MATHEMATICA
a[n_]:=Module[{s={n}, p=2, c=1}, While[s[[-1]]!=1, If[OddQ[s[[-1]]], AppendTo[s, s[[-1]]+p]; p=NextPrime[p], AppendTo[s, s[[-1]]/2]]; c++]; c-1]; Array[a, 67]
PROG
(Python)
from sympy import nextprime
def sisyphus(start): # generator of Sisyphus sequence beginning at start
an, p = start, 1
while True: yield an; an = an+(p:=nextprime(p)) if an&1 else an>>1
def a(n): return next(k for k, t in enumerate(sisyphus(n)) if t == 1)
print([a(n) for n in range(1, 68)]) # Michael S. Branicky, Sep 16 2025
CROSSREFS
KEYWORD
look,sign,new
AUTHOR
James C. McMahon, Sep 13 2025
STATUS
approved


Scatterplot of terms:
Why do terms cluster near certain values (see horizontal bands in below diagram):

Sunday, September 14, 2025

The Sisyphus Sequence (A350877)

(Image: Sisyphus (1548–49) by Titian, Prado Museum, Madrid, Spain)

Sisyphus, in Greek mythology, was cursed upon death to roll a large boulder up a hill only for it to roll down once it neared the top, repeating for eternity. 

The integer sequence, OEIS:  (https://oeis.org/A350877) starts 1, 3, 6, 3, 8, 4, 2, 1, 8 ,4, 2, 1, 12, 6, 3, 16, 8, 4, 2, 1... . The formal definition for the sequence is: start the sequence S with a(1) = 1 and extend S with a(n)/2 when a(n) is even, otherwise with a(n) + the smallest prime not yet added. The sequence was named Sisyphus because the sequence climbs only to drop back to 1.

Additional notes on the sequence:  Michael De Vlieger's OEIS sequence analysis: A350877.


A proposed variant of this sequence is to begin the sequence with n, integers 1 and greater, and define a(n) as the number of steps required to reach 1. This new sequence is: 

0, 1, 5, 2, 979, 6, 8, 3, 13, 980, 6, 7, 209, 9, 980, 4, 8, 14, 9, 981, 10, 7, 14, 8, 980, 210, 7, 10, 20, 981, 210, 5, 14, 9, 981, 15, 13, 10, 9, 982, 210, 11, 10, 8, 806, 15, 11, 9, 9, 981, 15, 211, 980, 8, 981, 11, 11, 21, 8, 982, 16, 211, 21, 6, 981, 15, 211...

a(1) = 0 because no further steps are required to reach 1.
a(2) = 1 because in one step, 2/2 =1, 1 is reached.
a(3) = 5 the steps proceed: 5, 8, 4, 2, 1 (5 steps to reach 1).

An interesting feature of this new sequence is how terms tend to cluster around certain values - from just the first 67 terms above, see terms clustered around 11, 210, 980.


This clustering feature is shown below in the scatterplot of the first 4000 terms:

Michael De Vlieger produced a log-log scatterplot of the first 65536 terms, which shows how this clustering continues:


Sequence published: https://oeis.org/A388038



Wednesday, July 16, 2025

Narcissistic Numbers

 (Image: Narciso (Jan Cossiers), CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via Wikimedia Commons)

In Greek mythology, Narcissus was known for his beauty. He rejected advances from all suitors, both men and women, and instead fell in love with his own reflection. The legend gives us the source of the words narcissist and narcissistic. 

There are also numbers known as Narcissistic Numbers. In the On-Line Encyclopedia of Integer Sequences (OEIS), sequence A005188 defines such numbers to be:  m-digit positive numbers equal to the sum of the m-th powers of their digits.

For example, the number 153 has 3 digits. The sum of 1^3 + 5^3 + 3^3 = 153. The sequence of Narcissistic Numbers begins: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407...

Narcissistic Numbers.

Tuesday, July 15, 2025

Münchhausen Numbers

 

(Image: Statue of Baron Münchhausen riding half of a horse - https://commons.wikimedia.org/wiki/User:Franzfoto)

Baron Münchhausen is a fictional character known for making exaggerated stories (other spellings include Munchhausen and Munchausen). In addition to the fables of the Baron, the name is used to describe Münchhausen syndrome and Münchhausen syndrome by proxy, in which someone fabricates a story of their illness or the illness of one they care for to gain attention or sympathy.

There are also numbers known as Münchhausen Numbers. These are numbers that equal the sum of each of their digits raised to their own power. For example, in base ten, the numbers include 1 and 3435. 1^1=1, 3^3 +4^4+3^3+5^5=3435. This sequence of numbers is A046253 in the On-Line Encyclopedia of Integer Sequences (OEIS). Another sequence of other Münchhausen Numbers is A166623, which lists such numbers in multiple bases.

Monday, July 14, 2025

Achilles Numbers

 

(Photo: Closeup of Achilles thniskon in Corfu Achilleion  - Dr.K., CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons)

In Greek mythology, Achilles, a central figure in Homer's Iliad, was known as the greatest Greek warrior. By legend, Achilles was invulnerable in all of his body except for one heel. According to myth, when his mother Thetis dipped him in the river Styx as an infant, she held him by one of his heels, leaving it untouched by the waters and thus his only vulnerable body part. To this day, Achilles' heel refers to a point of weakness that can lead to downfall.

There is also a series of numbers named for Achilles. Sequence A052486 of the On-Line Encyclopedia of Integer Sequences (OEIS) describes Achilles numbers as "powerful but imperfect: if n = Product(p_i^e_i) then all e_i > 1 (i.e., powerful), but the highest common factor of the e_i is 1, i.e., not a perfect power."

This definition uses the names of other types of numbers. 

Powerful numbers:  if a prime p divides n then p^2 must also divide n (also called squareful, square full, square-full or 2-powerful numbers). This is sequence A001694 in the OEIS.

Perfect numbers: Numbers k such that k is equal to the sum of the proper divisors of k. See OEIS: A000396.

Perfect power: Numbers of the form m^k where m > 0 and k >= 2.  See OEIS: A001597.

The first few Achilles numbers are: 72, 108, 200, 288, 392.


This post was inspired by the comment left by a reader to a recent post about the number 108. He recognized that 108 is also an Achilles number.

Also see: A388293, Cubefull Achilles numbers.

Sunday, July 6, 2025

50400: A Highly Composite Number



This blog recently had its 50400th visitor. The number 50400 is the 27th highly composite number. A highly composite number has more divisors than all previous highly composite numbers. In the case of 50400, it has 108 divisors.

The first 27 highly composite numbers and the number of their divisors are:

Order

Highly Composite Number

Number of Divisors

1

1

1

2

2

2

3

4

3

4

6

4

5

12

6

6

24

8

7

36

9

8

48

10

9

60

12

10

120

16

11

180

18

12

240

20

13

360

24

14

720

30

15

840

32

16

1260

36

17

1680

40

18

2520

48

19

5040

60

20

7560

64

21

10080

72

22

15120

80

23

20160

84

24

25200

90

25

27720

96

26

45360

100

27

50400

108


The highly composite numbers are designated in the On-Line Encyclopedia of Integer Sequences as A002182 , and the number of their divisors is the sequence A002183.

16670, A Saintly Number

  (Image: By Unknown author - http://santuarioeucaristico.blogspot.hu/2010/08/sao-maximiliano-kolbe-14-de-agosto.html, Public Domain, https:...

Popular in last 30 days