HP Forums

Full Version: a prime year
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Welcome to 2017, a prime year!

When was the last prime year?

When will be the next prime year?
Also... 9² + 44² = 2017
(01-01-2017 06:12 PM)Don Shepherd Wrote: [ -> ]Welcome to 2017, a prime year!

When was the last prime year?

When will be the next prime year?

2011
2027
(01-01-2017 07:07 PM)Massimo Gnerucci Wrote: [ -> ]
(01-01-2017 06:12 PM)Don Shepherd Wrote: [ -> ]Welcome to 2017, a prime year!

When was the last prime year?

When will be the next prime year?

2011
2027

right!!
PREVPRIME LASTARG NEXTPRIME
(01-01-2017 09:45 PM)Don Shepherd Wrote: [ -> ]
(01-01-2017 07:07 PM)Massimo Gnerucci Wrote: [ -> ]2011
2027

right!!

I'll vote for a "lastprime" function in the WP34s if you are going to ask more questions like that Smile
(01-02-2017 02:17 PM)Harald Wrote: [ -> ]I'll vote for a "lastprime" function in the WP34s if you are going to ask more questions like that Smile

The code is in XROM, just not included in any image:

Code:
        XLBL"PREVPRIME"
            INTM?
                JMP prevprime_xin
            DBL?
                JMP prevprime_dbl
            xIN MONADIC

            _INT 50
            _INT 16
            10[^x]
            STO+ Y
            RCL Z
            x>? Z
                ERR ERR_DOMAIN
            MIN
            JMP prevprime_skip_xin

prevprime_dbl::        [infinity]?
                ERR ERR_DOMAIN
prevprime_xin::        xIN MONADIC
prevprime_skip_xin::    CEIL
            PRIME?
                DEC X
            x[<=]1?
                ERR ERR_DOMAIN
            EVEN?
prevprime_loop::        DEC X
            x[<=]1?
                JMP prime_2
            PRIME?
                xOUT xOUT_NORMAL
            DEC X
            JMP prevprime_loop

It would be easy enough to key this in as a user program.


Pauli
Happy New Year to everyone.

A few funny things about 2017:

2017 = 9^2+44^2
= 12^2+28^2+33^2
= 7^3+7^3+11^3
= 6^3+7^3+9^3+9^3
= 2^3+4^3+6^3+9^3+10^3
= 1^3+6^3+6^3+7^3+8^3+9^3 = ....

Best wishes,
JM.
Happy New Prime Year!
While prime, not a perfect year:

https://oeis.org/A061013
Reference URL's