Tuesday, February 25, 2025

A381149 Contribution to the OEIS

 A381149

a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + sum of prior prime terms.
+40
0
2, 3, 8, 13, 31, 80, 129, 178, 227, 503, 1282, 2061, 2840, 3619, 4398, 5177, 5956, 6735, 7514, 8293, 17365, 26437, 61946, 97455, 132964, 168473, 203982, 239491, 275000, 310509, 346018, 381527, 798563, 1215599, 1632635, 2049671, 2466707, 5350450, 8234193, 11117936
OFFSET
1,1
LINKS
EXAMPLE
For n=5, a(5) = a(4) + sum of prior primes = 13 + (2 + 3 + 13) = 31, so that 13 is counted twice.
MATHEMATICA
Nest[Append[#, #[[-1]]+Total[Select[#, PrimeQ]]]&, {2, 3}, 38]
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
yield from [2, 3]
primesum, an = 5, 3
while True:
an += primesum
if isprime(an): primesum += an
yield an
print(list(islice(agen(), 40))) # Michael S. Branicky, Feb 19 2025
CROSSREFS
KEYWORD
nonn,new
AUTHOR
James C. McMahon, Feb 15 2025
STATUS
approved

This sequence is similar to my other sequence submitted at the same time, A381150. However, I think A381150 is more interesting because of the terms that repeat and also how it cycles between positive and negative terms. Link to prior post: https://jamesmacmath.blogspot.com/2025/02/a-sequence-with-competing-sums-of-prior.html

Thursday, February 20, 2025

A381150 Contribution to the OEIS

   


Recently proposed for the On-Line Encyclopedia of Integer Sequences (OEIS) is the sequence:

a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + (sum of prior prime terms or whose negatives are prime) - (sum of prior composite terms or whose negatives are composite).

   The sequence starts: 2, 3, 8, 5, 7, 16, 9, -7, -30, -23, -39, -16, 23, 85, 62, -23, -131... and continues to cycle through negative and positive integers. Although the sequence is not periodic, it does repeat terms. For example, the  term 347 (or its negative) occurs nine times in the first 48 terms. The 418th (or its negative) occurs 71 times in a span of 211 terms.

    My colleague, Michael De Vlieger, produced the graphic showing the sequence's progression shown above.

    If approved, the sequence will become A381150. Currently, it is still in draft form: https://oeis.org/A381150.

    Update: The sequence was published 2/25/2025.


A381150
a(0) = 1, a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + (sum of prior prime terms or whose negatives are prime) - (sum of prior composite terms or whose negatives are composite).
0
1, 2, 3, 8, 5, 7, 16, 9, -7, -30, -23, -39, -16, 23, 85, 62, -23, -131, -370, -239, -347, -802, -455, 347, 1496, 1149, -347, -2190, -1843, 347, 2884, 2537, -347, -3578, -3231, 347, 4272, 3925, -347, -4966, -4619, 347, 5660, 5313, -347, -6354, -6007, -11667, -5660

OFFSET
0,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10003 (a(n) for n = 1..1000 from James C. McMahon)
Michael De Vlieger, Scatterplot of m*log_10(m*a(n)), n = 1..2^10, where m = 1 of a(n) > 0 (shown in green) and m = -1 if a(n) < 0 (shown in red).
Michael De Vlieger, Scatterplot of m*log_10(m*a(n)), n = 1..2^16, where m = 1 of a(n) > 0 (shown in green) and m = -1 if a(n) < 0 (shown in red).
EXAMPLE
For n=5, a(5) = 5 + (2 + 3 + 5) - 8 = 7.
For n=9, a(9) = -7 + (2 + 3 + 5 + 7 -7) - (8 + 16 + 9) = -7 + 10 - 33 = -30
MAPLE
b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+(t->
`if`(isprime(abs(t)), t, `if`(abs(t)>1, -t, 0)))(a(n)))
end:
a:= proc(n) option remember; `if`(n<3, n+1, a(n-1)+b(n-1)) end:
seq(a(n), n=0..48); # Alois P. Heinz, Feb 15 2025
MATHEMATICA
Nest[Append[#, #[[-1]]+Total[Select[#, PrimeQ]]-Total[Select[#, CompositeQ]]]&, {1, 2, 3}, 46]
KEYWORD
sign,new
AUTHOR
James C. McMahon, Feb 15 2025
STATUS
approved






Monday, February 17, 2025

Using Excel Solver to Find the Solution to a Geometry Puzzle

The Monday Puzzle in the Guardian by Alex Bellos had a good problem to illustrate the use of Excel Solver. The link to the article is: https://www.theguardian.com/science/2025/feb/17/did-you-solve-it-the-simple-geometry-problem-that-fools-almost-everyone.

Restated, the problem is to divide an 11 x 11 square into five rectangles so that the ten side lengths are the whole numbers from 1 to 10? 

Below is the 11 x 11 square with five rectangles and the ten sides labeled A through J. 


To use Excel Solver to find a solution, ten cells of the spreadsheet will be designated as the decision variables. In the attached spreadsheet, these are simply the cells A1 through J1. Solver will change their values until a solution is found. 

In rows 3 through 8 are 6 constraints:
A+D=11
C+F=11
E+H=11
G+B=11
H+J+D=11
B+I+F=11

Also in Solver, additional constraints are entered:
All values, A through J, are => 1 and <= 10.
All values, A through J, are integers.
All values, A through J, are different.

With these constraints entered, click the Solve button, and one of the solutions is displayed:

A=6, B=3, C=10, D=5, E=9, F=1, G=8, H=2, I=7, J=4






An Open Message to the Blog's Fans in Singapore

(Image:  Free 12 singapore icons - Iconfinder ) This past week, more views of this blog were made from Singapore than other country. To ackn...

Popular in last 30 days