主要内容

搜索


Joseff Bailey-Wood
Joseff Bailey-Wood
上次活动时间: 大约 22 小时 前

Hi! I'm Joseff and along with being a student in chemical engineering, one of my great passions is language-learning. I learnt something really cool recently about Catalan (a romance language closely related to Valencian that's spoken in Andorra, Catalonia, and parts of Spain) — and that is how speakers tell the time.
While most European languages stick to the standard minutes-past / minutes-to between hours, Catalan does something really quite special, with a focus on the quarters (quarts [ˈkwarts]). To see what I mean, take a look at this clock made by Penguin___Lover on Instructables :
If you want to tell the time in Catalan, you should refer to the following hour (the one that's still to come), and how many minutes have passed or will pass for the closest quarter (sometimes half-quarter / mig quart [ˈmit͡ʃ kwart]) — clear as mud? It's definitely one of the more difficult things to wrap your head around as a learner. But fear not, with the power of MATLAB, we'll understand in no time!
To make a tool to tell the time in Catalan, the first thing we need to do is extract the current time into its individual hours, minutes and seconds*
function catalanTime = quinahora()
% Get the current time
[hours, minutes, seconds] = hms(datetime("now"));
% Adjust hours to 12-hour format
catalanHour = mod(hours-1, 12)+1;
nextHour = mod(hours, 12)+1;
Then to defining the numbers in catalan. It's worth noting that because the hours are feminine and the minutes are masculine, the words for 1 and 2 is different too (this is not too weird as languages go, in fact for my native Welsh there's a similar pattern between 2 and 4).
% Define the numbers in Catalan
catNumbers.masc = ["un", "dos", "tres", "quatre", "cinc"];
catNumbers.fem = ["una", "dues", "tres", "quatre",...
"cinc", "sis", "set", "vuit",...
"nou", "deu", "onze", "dotze"];
Okay, now it's starting to get serious! I mentioned before that this traditional time telling system is centred around the quarters — and that is true, but you'll also hear about the mig de quart (half of a quarter) * which is why we needed that seconds' precision from earlier!
% Define 07:30 intervals around the clock from 0 to 60
timeMarks = 0:15/2:60;
timeFraction = minutes + seconds / 60; % get the current position
[~, idx] = min(abs(timeFraction - timeMarks)); % extract the closest timeMark
mins = round(timeFraction - timeMarks(idx)); % round to the minute
After getting the fraction of the hour that we'll use later to tell the time, we can look into how many minutes it differs from that set time, using menys (less than) and i (on top of). There's also a bit of an AM/PM distinction, so you can use this function and know whether it's morning or night!
% Determine the minute string (diffString logic)
diffString = '';
if mins < 0
diffString = sprintf(' menys %s', catNumbers.masc(abs(mins)));
elseif mins > 0
diffString = sprintf(' i %s', catNumbers.masc(abs(mins)));
end
% Determine the part of the day (partofDay logic)
if hours < 12
partofDay = 'del matí'; % Morning (matí)
elseif hours < 18
partofDay = 'de la tarda'; % Afternoon (tarda)
elseif hours < 21
partofDay = 'del vespre'; % Evening (vespre)
else
partofDay = 'de la nit'; % Night (nit)
end
% Determine 'en punt' (o'clock exactly) based on minutes
enPunt = '';
if mins == 0
enPunt = ' en punt';
end
Now all that's left to do is define the main part of the string, which is which mig quart we are in. Since we extracted the index idx earlier as the closest timeMark, it's just a matter of indexing into this after the strings have been defined.
% Create the time labels
labels = {sprintf('són les %s%s%s %s', catNumbers.fem(catalanHour), diffString, enPunt, partofDay), ...
sprintf('és mig quart de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('és un quart de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('és un quart i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són dos quarts de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són dos quarts i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són tres quarts de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són tres quarts i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són les %s%s%s %s', catNumbers.fem(nextHour), diffString, enPunt, partofDay)};
catalanTime = labels{idx};
Then we need to do some clean up — the definite article les / la and the preposition de don't play nice with un and the initial vowel in onze, so there's a little replacement lookup here.
% List of old and new substrings for replacement
oldStrings = {'les un', 'són la una', 'de una', 'de onze'};
newStrings = {'la una', 'és la una', 'd''una', 'd''onze'};
% Apply replacements using a loop
for i = 1:length(oldStrings)
catalanTime = strrep(catalanTime, oldStrings{i}, newStrings{i});
end
end
quinahora()
ans = 'és un quart i mig de nou menys tres del vespre'
So, can you work out what time it was when I made this post? 🤔
And how do you tell the time in your language?
Fins després!

Bonsoir

Je me permets de vous contacter afin d’obtenir des informations et un encadrement concernant un projet sur lequel je travaille actuellement. Il s’agit d’une application visant à réguler un oscillateur quantique en potentiel harmonique à l’aide de l’intelligence artificielle.

Plus précisément, mon objectif est de :

Modéliser l’évolution de l’oscillateur quantique sous un potentiel harmonique.

Appliquer des techniques d’IA (réseaux de neurones, renforcement, etc.) pour optimiser la régulation de son état.

Analyser les performances des algorithmes dans le cadre de cette régulation.

Je souhaiterais savoir si vous pourriez m’apporter des conseils ou un encadrement dans la réalisation de ce projet, notamment sur les aspects mathématiques, physiques et computationnels impliqués. De plus, toute suggestion sur des références bibliographiques ou des outils adaptés (MATLAB, Python, TensorFlow, etc.) serait également très précieuse.

Dans l’attente de votre retour, Bien cordialement,

📢 We want to hear from you! We're a team of graduate student researchers at the University of Michigan studying MATLAB Drive and other cloud-based systems for sharing coding files. Your feedback will help improve these tools. Take our quick survey here: https://forms.gle/DnHs4XNAwBZvmrAw6
Hello,
I hope you are doing well. I need your help in developing a Matlab model for the modeling and simulation of the energy and environmental performance of an improved stove (furnace) for the combustion of charcoal briquettes (biochar). I would really appreciate your assistance.
Thank you very much.
Wan Muhamad Hakimi
Wan Muhamad Hakimi
上次活动时间: 2025-3-14,17:27

Hi! I am using F28379D DSP. I would like to generate 20khz and 50% duty cycle. I have use ADC with the input 3Vac from voltage sensor. The TBPRD set is 2500 and the CMP value is 1250 with prescaler 1. EPWM1A and EPWM 1B are utilised in this case. Unfortunately EPWM1A duty cycle is shifting/moving/not in phase, EPWM1B is constantly producing 20khz. I am using updown counter. CAU is set CAD is Clear same goes to EPWM1B. Why this happen? I would like to do a switching where PWM 20khz is on during positive half cycle, PWM 20khz is off during negative half cycle. Appreciate for the help!

Imagine you are developing a new toolbox for MATLAB. You have a folder full of a few .m files defining a bunch of functions and you are thinking 'This would be useful for others, I'm going to make it available to the world'
What process would you go through? What's the first thing you'd do?
I have my own opinions but don't want to pollute the start of the conversation :)
Hello MATLAB Community,
I'm working on a project where I need to model and simulate a generator or motor system in Simulink, and I want to get the output voltage based on certain design parameters, including the number of turns, magnets, and coils.
I’m looking for a Simulink model or component that would allow me to input:
  • The number of turns in the coils
  • The number of magnets
  • The number of coils
And then, based on this design, output the voltage generated by the system.
I would appreciate any guidance on:
  • Specific Simulink components or models that are suited for this purpose
  • Whether there’s a prebuilt block or if I need to build a custom model
  • Any tips or examples that can help me set up this simulation
Thanks in advance for your help!
Best regards,
Siyabonga
Over the last 5 years or so, the highest-traffic post on my MATLAB Central image processing blog was not actually about image processing; it was about changing the default line thickness in plots.
Now I have written about some other MATLAB plotting behavior that I have recently changed to suit my own preferences. See this new blog post.
Here is a standard MATLAB plot:
x = 0:pi/100:2*pi;
y1 = sin(x);
y2 = cos(x);
plot(x,y1,x,y2)
I don't like some aspects of this plot, and so I have put the following code into my startup file.
set(groot,"DefaultLineLineWidth",2)
set(groot,"DefaultAxesXLimitMethod","padded")
set(groot,"DefaultAxesYLimitMethod","padded")
set(groot,"DefaultAxesZLimitMethod","padded")
set(groot,"DefaultAxesXGrid","on")
set(groot,"DefaultAxesYGrid","on")
set(groot,"DefaultAxesZGrid","on")
With those defaults changed, here is my preferred appearance:
plot(x,y1,x,y2)
To develop uifigure-based app, I wish MATLAB can provide something like uiquestdlg to replace questdlg without changing too much of the original code developed for figure-based app. Also, uiinputdlg <-> inputdlg and so on.
It is time to support the cameraIntrinsics function to accept a 3-by-3 intrinsic matrix K as an input parameter for constructing the object. Currently, the built-in cameraIntrinsics function can only be constructed by explicitly specifying focalLength, principalPoint, and imageSize. This approach has drawbacks, as it is not very intuitive. In most application scenarios, using the intrinsic matrix
K=[fx,0,cx;
0,fy,cy;
0,0,1]
is much more straightforward and effective!
intrinsics = cameraIntrinsics(K)
Learn the basic of quantum computing, how to simulate quantum circuits on MATLAB and how to run them on real quantum computers using Amazon Braket. There will also be a demonstration of machine learning using quantum computers!
Details at MATLAB-AMAZON Braket Hands-on Quantum Machine Learning Workshop - MATLAB & Simulink. This will be led by MathWorker Hossein Jooya.
I kicked off my own exploration of Quantum Computing in MATLAB a year or so ago and wrote it up on The MATLAB Blog: Quantum computing in MATLAB R2023b: On the desktop and in the cloud » The MATLAB Blog - MATLAB & Simulink. This made use of the MATLAB Support Package for Quantum Computing - File Exchange - MATLAB Central
insherah
insherah
上次活动时间: 2025-3-4,22:02

I need guidance how to create random forest block in simulink My coding use tree bagger for classification

yousfi
yousfi
上次活动时间: 2025-3-4,9:58

I want to impliment Park and Clark transform in matlab Simulink can anyone help me do it plz
"I need an exchange file for symmetrical fault analysis for the protection coordination of relays but cannot find it. Could you suggest how I can find it?"
i have to paste the url generated in the output ide everytime to get the data on my thingspeak channel: e,g.: http://api.thingspeak.com/update?api_key=382U4EOXANOKEW3I&field1=27.25&field2=3.27&field3=0.00
my code is :
#include "DHT.h"
#define DHTPIN 15 // Pin where DHT sensor is connected
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
#define THINGSPEAK_API_KEY "382U4EOXANOKEW3I"
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ArduinoJson.h>
SoftwareSerial myserial(10, 11); // RX, TX for GSM communication
// Temperature Sensor Setup
#define ONE_WIRE_BUS 5
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
// Flow Sensor Setup
#define SENSOR_PIN 2
volatile byte pulseCount = 0;
float flowRate = 0.0;
unsigned int flowMilliLitres = 0;
unsigned long totalMilliLitres = 0;
unsigned long oldTime = 0;
float calibrationFactor = 5.5; // Calibration factor for flow meter
// Turbidity Sensor Setup
int turbiditySensorValue;
float voltage;
// Variables for DHT sensor
float temperatureC;
float temperatureF;
void setup() {
Serial.begin(9600);
myserial.begin(9600);
pinMode(SENSOR_PIN, INPUT);
digitalWrite(SENSOR_PIN, HIGH);
pulseCount = 0;
flowRate = 0.0;
flowMilliLitres = 0;
totalMilliLitres = 0;
oldTime = 0;
attachInterrupt(digitalPinToInterrupt(SENSOR_PIN), pulseCounter, FALLING);
sensors.begin(); // Initialize temperature sensor
dht.begin(); // Initialize DHT sensor
// GSM Initialization with better error checking
initGSM();
}
void initGSM() {
Serial.println("Initializing GSM...");
// Wait for GSM module to respond
while (!sendATCommand("AT", "OK", 1000)) {
Serial.println("Waiting for GSM module...");
delay(1000);
}
sendATCommand("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", "OK", 2000);
sendATCommand("AT+SAPBR=3,1,\"APN\",\"your_apn\"", "OK", 2000); // Change APN if needed
sendATCommand("AT+SAPBR=1,1", "OK", 2000);
sendATCommand("AT+SAPBR=2,1", "OK", 2000);
}
bool sendATCommand(const char* command, const char* expected_answer, unsigned int timeout) {
Serial.println("Sending command: " + String(command));
myserial.println(command);
String response = "";
unsigned long previous = millis();
while (millis() - previous < timeout) {
while (myserial.available()) {
char c = myserial.read();
response += c;
}
if (response.indexOf(expected_answer) >= 0) {
Serial.println("Response: " + response); // Print full response
return true;
}
}
Serial.println("Timeout! No response or unexpected response: " + response);
return false;
}
void loop() {
flowMeter();
temperature();
turbidity();
sendToThingSpeak();
delay(15000); // 15 second delay between readings
}
void flowMeter() {
if ((millis() - oldTime) > 1000) {
detachInterrupt(digitalPinToInterrupt(SENSOR_PIN));
flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
oldTime = millis();
flowMilliLitres = (flowRate / 60) * 1000;
totalMilliLitres += flowMilliLitres;
Serial.print("Flow rate: ");
Serial.print(flowRate, 2); // Print with 2 decimal places
Serial.println(" L/min");
pulseCount = 0;
attachInterrupt(digitalPinToInterrupt(SENSOR_PIN), pulseCounter, FALLING);
}
}
void pulseCounter() {
pulseCount++;
}
void temperature() {
sensors.requestTemperatures();
temperatureC = sensors.getTempCByIndex(0);
temperatureF = sensors.toFahrenheit(temperatureC);
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println("°C");
}
void turbidity() {
turbiditySensorValue = analogRead(A0);
voltage = turbiditySensorValue * (5.0 / 1024.0);
Serial.print("Turbidity Voltage: ");
Serial.println(voltage, 2); // Print with 2 decimal places
}
void sendToThingSpeak() {
// Check if GSM is connected
if (!sendATCommand("AT+SAPBR=2,1", "OK", 2000)) {
Serial.println("GSM Network Issue! Not sending data.");
return;
}
// Close any existing HTTP connection
sendATCommand("AT+HTTPTERM", "OK", 1000);
delay(1000);
// Initialize HTTP service
if (!sendATCommand("AT+HTTPINIT", "OK", 2000)) {
Serial.println("HTTP init failed");
return;
}
sendATCommand("AT+HTTPPARA=\"CID\",1", "OK", 1000);
// Construct URL properly
String url = "http://api.thingspeak.com/update?api_key=";
url += THINGSPEAK_API_KEY;
url += "&field1=" + String(temperatureC);
url += "&field2=" + String(voltage);
url += "&field3=" + String(flowRate);
Serial.println("Generated URL: " + url); // Print full URL before sending
// Send URL parameter properly
String command = "AT+HTTPPARA=\"URL\",\"" + url + "\"";
if (!sendATCommand(command.c_str(), "OK", 2000)) {
Serial.println("Setting URL failed");
return;
}
// Start HTTP GET request
if (!sendATCommand("AT+HTTPACTION=0", "+HTTPACTION: 0,200", 5000)) {
Serial.println("HTTP GET command failed");
return;
}
delay(5000); // Wait for response
// Read HTTP response
if (!sendATCommand("AT+HTTPREAD", "OK", 5000)) {
Serial.println("Failed to read HTTP response");
return;
}
Serial.println("Data sent successfully!");
// Close HTTP connection
sendATCommand("AT+HTTPTERM", "OK", 1000);
}
Tawanda
Tawanda
上次活动时间: 2025-3-2,14:05

Good day I am looking someone to help me on the matlab and simulink I am missing some explanations.For easy communication you can contact 0026876637042
Recently my iMac became sluggish. I checked Activity Monitor and found it was spending most of its time in mds_stores. I turned of Apple Intelligence under System Settings - Apple Intelligence & Siri, and its like new again.
The GCD approach to identify rough numbers is a terribly useful one, well worth remembering. But at some point, I expect someone to notice that all work done with these massively large symbolic numbers uses only one of the cores on your computer. And, having spent so much money on those extra cores in your CPU, surely we can find a way to use them all? The problem is, computations done on symbolic integers never use more than 1 core. (Sad, unhappy face.)
In order to use all of the power available to your computer using MATLAB, you need to work in double precision, or perhaps int64 or uint64. To do that, I'll next search for primes among the family 3^n+4. In fact, they seem pretty common, at least if we look at the first few such examples.
F = @(n) sym(3).^n + 4;
F(0:16)
ans =
[5, 7, 13, 31, 85, 247, 733, 2191, 6565, 19687, 59053, 177151, 531445, 1594327, 4782973, 14348911, 43046725]
isprime(F(0:16))
ans =
1×17 logical array
1 1 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0
Of the first 11 members of that sequence, 7 of them were prime. Naturally, primes will become less frequent in this sequence as we look further out. The members of this family grow rapidly in size. F(10000) has 4771 decimal digits, and F(100000) has 47712 decimal digits. We certainly don't want to directly test every member of that sequence for primality. However, what I will call a partial or incomplete sieve can greatly decrease the work needed.
Consider there are roughly 5.7 million primes less than 1e8.
numel(primes(1e8))
ans =
5761455
F(17) is the first member of our sequence that exceeds 1e8. So we can start there, since we already know the small-ish primes in this sequence.
roughlim = 1e8;
primes1e8 = primes(roughlim);
primes1e8([1 2]) = []; % F(n) is never divisible by 2 or 3
F_17 = double(F(17));
Fremainders = mod(F_17,primes1e8);
nmax = 100000;
FnIsRough = false(1,nmax);
for n = 17:nmax
if all(Fremainders)
FnIsRough(n) = true;
end
% update the remainders for the next term in the sequence
% This uses the recursion: F(n+1) = 3*F(n) - 8
Fremainders = mod(Fremainders*3 - 8,primes1e8);
end
sum(FnIsRough)
ans =
6876
These will be effectively trial divides, even though we use mod for the purpose. The result is 6876 1e8-rough numbers, far less than that total set of 99984 values for n. One thing of great importance is to recognize this sequence of tests will use an approximately constant time per test regardless of the size of the numbers because each test works off the remainders from the previous one. And that works as long as we can update those remainders in some simple, direct, and efficient fashion. All that matters is the size of the set of primes to test against. Remember, the beauty of this scheme is that while I did what are implicitly trial divides against 5.76 million primes at each step, ALL of the work was done in double precision. That means I used all 8 of the cores on my computer, pushing them as hard as I could. I never had to go into the realm of big integer arithmetic to identify the rough members in that sequence, and by staying in the realm of doubles, MATLAB will automatically use all the cores you have available.
The first 10 values of n (where n is at least 17), such that F(n) is 1e8-rough were
FnIsRough = find(FnIsRough);
FnIsRough(1:10)
ans =
22 30 42 57 87 94 166 174 195 198
How well does the roughness test do to eliminate composite members of this sequence?
isprime(F(FnIsRough(1:10)))
ans =
1×10 logical array
1 1 1 1 1 0 0 1 1 1
As you can see, 8 of those first few 1e8-rough members were actually prime, so only 2 of those eventual isprime tests were effectively wasted. That means the roughness test was quite useful indeed as an efficient but relatively weak pre-test for possible primality. More importantly it is a way to quickly eliminate those values which can be known to be composite.
You can apply a similar set of tests on many families of numbers. For example, repunit primes are a great case. A rep-digit number is any number composed of a sequence of only a single digit, like 11, 777, and 9999999999999.
However, you should understand that only rep-digit numbers composed of entirely ones can ever be prime. Naturally, any number composed entirely of the digit D, will always be divisible by the single digit number D, and so only rep-unit numbers can be prime. Repunit numbers are a subset of the rep-digit family, so numbers composed only of a string of ones. 11 is the first such repunit prime. We can write them in MATLAB as a simple expression:
RU = @(N) (sym(10).^N - 1)/9;
RU(N) is a number composed only of the digit 1, with N decimal digits. This family also follows a recurrence relation, and so we could use a similar scheme as was used to find rough members of the set 3^N-4.
RU(N+1) == 10*RU(N) + 1
However, repunit numbers are rarely prime. Looking out as far as 500 digit repunit numbers, we would see primes are pretty scarce in this specific family.
find(isprime(RU(1:500)))
ans =
2 19 23 317
There are of course good reasons why repunit numbers are rarely prime. One of them is they can only ever be prime when the number of digits is also prime. This is easy to show, as you can always factor any repunit number with a composite number of digits in a simple way:
1111 (4 digits) = 11*101
111111111 (9 digits) = 111*1001001
Finally, I'll mention that Mersenne primes are indeed another example of repunit primes, when expressed in base 2. A fun fact: a Mersenne number of the form 2^n-1, when n is prime, can only have prime factors of the form 1+2*k*n. Even the Mersenne number itself will be of the same general form. And remember that a Mersenne number M(n) can only ever be prime when n is itself prime. Try it! For example, 11 is prime.
Mn = @(n) sym(2).^n - 1;
Mn(11)
ans =
2047
Note that 2047 = 1 + 186*11. But M(11) is not itself prime.
factor(Mn(11))
ans =
[23, 89]
Looking carefully at both of those factors, we see that 23 == 1+2*11, and 89 = 1+8*11.
How does this help us? Perhaps you may see where this is going. The largest known Mersenne prime at this date is Mn(136279841). This is one seriously massive prime, containing 41,024,320 decimal digits. I have no plans to directly test numbers of that size for primality here, at least not with my current computing capacity. Regardless, even at that realm of immensity, we can still do something.
If the largest known Mersenne prime comes from n=136279841, then the next such prime must have a larger prime exponent. What are the next few primes that exceed 136279841?
np = NaN(1,11); np(1) = 136279841;
for i = 1:10
np(i+1) = nextprime(np(i)+1);
end
np(1) = [];
np
np =
Columns 1 through 8
136279879 136279901 136279919 136279933 136279967 136279981 136279987 136280003
Columns 9 through 10
136280009 136280051
The next 10 candidates for Mersenne primality lie in the set Mn(np), though it is unlikely that any of those Mersenne numbers will be prime. But ... is it possible that any of them may form the next Mersenne prime? At the very least, we can exclude a few of them.
for i = 1:10
2*find(powermod(sym(2),np(i),1+2*(1:50000)*np(i))==1)
end
ans =
18 40 64
ans =
1×0 empty double row vector
ans =
2
ans =
1×0 empty double row vector
ans =
1×0 empty double row vector
ans =
1×0 empty double row vector
ans =
1×0 empty double row vector
ans =
1×0 empty double row vector
ans =
1×0 empty double row vector
ans =
2
Even with this quick test which took only a few seconds to run on my computer, we see that 3 of those Mersenne numbers are clearly not prime. In fact, we already know three of the factors of M(136279879), as 1+[18,40,64]*136279879.
You might ask, when is the MOD style test, using a large scale test for roughness against many thousands or millions of small primes, when is it better than the use of GCD? The answer here is clear. Use the large scale mod test when you can easily move from one member of the family to the next, typically using a linear recurrence. Simple such examples of this are:
1. Repunit numbers
General form: R(n) = (10^n-1)/9
Recurrence: R(n+1) = 10*R(n) + 1, R(0) = 1, R(1) = 11
2. Fibonacci numbers.
Recurrence: F(n+1) = F(n) + F(n-1), F(0) = 0, F(1) = 1
3. Mersenne numbers.
General form: M(n) = 2^n - 1
Recurrence: M(n+1) = 2*M(n) + 1
General form: C(n) = n*2^n + 1
Recurrence: C(n+1) = 4*C(n) + 4*C(n-1) + 1
5. Hampshire numbers: (My own choice of name)
General form: H(n,b) = (n+1)*b^n - 1
Recurrence: H(n+1,b) = 2*b*H(n-1,b) - b^2*H(n-2,b) - (b-1)^2, H(0,b) = 0, H(1,b) = 2*b-1
6. Tin numbers, so named because Sn is the atomic symbol for tin.
General form: S(n) = 2*n*F(n) + 1, where F(n) is the nth Fibonacci number.
Recurrence: S(n) = S(n-5) + S(n-4) - 3*S(n-3) - S(n-2) +3*S(n-1);
To wrap thing up, I hope you have enjoyed this beginning of a journey into large primes and non-primes. I've shown a few ways we can use roughness, first in a constructive way to identify numbers which may harbor primes in a greater density than would otherwise be expected. Next, using GCD in a very pretty way, and finally by use of MOD and the full power of MATLAB to test elements of a sequence of numbers for potential primality.
My next post will delve into the world of Fermat and his little theorem, showing how it can be used as a stronger test for primality (though not perfect.)