Community
cancel
Showing results for
Did you mean:
Valued Contributor I
235 Views

## Fortran, Number Theory and School Competition

I was scrolling through the Guardian at the weekend and I came across this competition statement for high school students.

The basic problem is the author defines 2021 as a special number == she used a weird name.

She said that special numbers are linked through {m, 2m+1 and 3m)  so 6063 is special and 1010 is special.

She asks if 2021 raised to the 2021 power is special.  I agree with the concept of her solution by proving 1 and 2 are special and then all numbers are likely to be special.

So, I was sitting at McDonalds waiting for a student, who did not show. I was doing the exercise in my mind, as this nice lady kept asking me if I wanted a refill.  Anyway I could not get in my head from 2021 to 1 or 2.

I had read her solutions, but I could not do a straight work out on her solution - she has a step 2021 to 573 which is not valid that I can see.

I wrote a simple absolutely brute force Fortran program assumed 1 was simple and then worked out all of the simple numbers to about 500000.

It appears to me that there are a small set of numbers if 1 is special that are not special starting at 500 and increasing by 6,  so 1010 is 500 + 85*6 and 2021 is not special as past 1010 we get a 3 series added to the 6 series.

I enclose the Fortran -- am I missing something?  == all of the odds near 2021 are special if 1 is special but not 2021

 2017 1 0 2019 1 1 2023 1 3 2025 1 1
8 Replies
Valued Contributor I
224 Views

The interesting problem with 2021 is it is one of those rare composites that are made up of only 2 primes, by the time you get to 2000 they are starting to space out.  43 and 47.

Super User
203 Views

You believe what you read in the Guardian?  Interesting.

Doc (not an Intel employee or contractor)

Valued Contributor I
181 Views

It is an interesting problem in math and then Fortran.  I will take it up with the author of the problem who is also an Australian.

After all Fortran is Formula Translation and no matter how fancy the language we are only working on 0 and 1.

The other interesting feature is that if we create a number system such that the primes are the bases,  descending - 19 17 13 11 7 5 3 2 then the number 1 is 2 and the number 0 is 1,  an interesting series is

0  = 1

11 = 6

12 = 12

21 = 18

13 = 24

so the basic question is why do we Fortran it is not for itself.

Sherman once said :: If I had my choice I would kill every reporter in the world, but I am sure we would be getting reports from Hell before breakfast.

We are all in the Brownian soup together.

Valued Contributor III
142 Views

The spelling will not be correct if it is in the Guardian aka the Grauniad.

Valued Contributor I
130 Views
``````Fæder ure
ðu ðe eart on heofenum
si ðin nama gehalgod
to-becume ðin rice
geweorþe ðin willa on eorðan swa swa on heofenum.
Urne ge dæghwamlican hlaf syle us to-deag
and forgyf us ure gyltas
swa swa we forgifaþ urum gyltendum
ane ne gelæde ðu us on costnunge
ac alys us of yfle.``````

A quick question -- can we print these old characters using a write statement in Fortran.

Valued Contributor III
123 Views

They may have disappeared from current-day English, but they remain part of the Icelandic language and others can be found be found in other nordic languages. So the attribute "old" is very subjective indeed ;).

Valued Contributor I
115 Views
``````!  Console12.f90
!
!  FUNCTIONS:
!  Console12 - Entry point of console application.
!

!****************************************************************************
!
!  PROGRAM: Console12
!
!  PURPOSE:  Entry point for the console application.
!
!****************************************************************************

program Console12

implicit none

! Variables

! Body of Console12
print *, 'The following sentence is derived from words in the dictionary of Webster'
print *,'My dawter espied a porpuss.'

end program Console12
``````

You are quite free to use those old letters, of course people would have to use context to tell them apart and languages evolve - look at Fortran.  it evolves to slowly and C# evolves to fast.

UNIX and C was written by two chaps from their photos look like they would have been happy in old Iceland.

As one of my students said yesterday - I hate math and there is a plethora in this paper.

Are you not impressed with plethora.

Valued Contributor III
90 Views

The real problem about these characters is not with Fortran - it is that the ASCII table is quite limited. Various solutions have been implemented to get around it, like code pages, where the ASCII characters in the second part (iachar(chr) > 127) are associated with different glyphs, UNICODE (4 bytes at least for a single character), UTF-8 (with a varying number of bytes for characters outside the first half of the ASCII table). It is more than possible to write UNICODE codes from within Fortran - they are after all just sequences of bytes. The real issue is to get them shown as the right glyphs. And depends on your terminal, file viewer, text processor or whatever tool you are using to convert the pile of bytes into a visible representation.

On Windows (the default code page) I see:

æ ð þ

when I run this tiny Fortran program:

``````program selectedchars
write(*,'(3(a,x))') achar(230), achar(240), achar(254)
end program selectedchars
``````

I can also find capital versions of these characters (hm, my last one be capital thorn - my knowledge of Icelandic and old English is less than it might have been if I had studied either or both...)

However, if I run the program in a DOS window, I see a Greek letter mu, a mathematical sign "equivalent" (three strokes) and a non-descript filled square.